0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-21 11:28:58 +01:00

chore: setup changesets (#8668)

Co-authored-by: dominikg <dominik.goepel@gmx.de>
This commit is contained in:
Ben McCann 2023-06-01 13:22:34 -07:00 committed by GitHub
parent f74dddd1d5
commit f2ff684b5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 1568 additions and 1486 deletions

8
.changeset/README.md Normal file
View File

@ -0,0 +1,8 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

11
.changeset/config.json Normal file
View File

@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": ["@svitejs/changesets-changelog-github-compact", { "repo": "sveltejs/svelte" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "version-4",
"bumpVersionsWithWorkspaceProtocolOnly": true,
"ignore": ["!(@sveltejs/*|svelte)"]
}

8
.changeset/pre.json Normal file
View File

@ -0,0 +1,8 @@
{
"mode": "pre",
"tag": "next",
"initialVersions": {
"svelte": "4.0.0-next.1"
},
"changesets": []
}

40
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: Release
on:
push:
branches:
- version-4
permissions: {}
jobs:
release:
# prevents this action from running on forks
if: github.repository == 'sveltejs/svelte'
permissions:
contents: write # to create release (changesets/action)
pull-requests: write # to create pull request (changesets/action)
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- uses: pnpm/action-setup@v2.2.4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
version: pnpm changeset:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@ -9,7 +9,9 @@
"build": "pnpm -r build",
"check": "pnpm -r check",
"lint": "pnpm -r lint",
"format": "pnpm -r format"
"format": "pnpm -r format",
"changeset:version": "changeset version && pnpm -r generate:version && git add --all",
"release": "changeset release"
},
"repository": {
"type": "git",

View File

@ -1,6 +1,5 @@
*.map
/src/compiler/compile/internal_exports.js
/src/shared/version.js
/compiler.d.ts
/compiler.cjs
/index.d.ts

View File

@ -12,6 +12,7 @@ src/shared/version.js
/test/**/_actual*
/test/**/expected*
/test/**/_output
/test/**/shards/*.test.js
/types
!rollup.config.js
!vitest.config.js

File diff suppressed because it is too large Load Diff

View File

@ -74,18 +74,19 @@
"format": "prettier . --cache --plugin-search-dir=. --write",
"check": "prettier . --cache --plugin-search-dir=. --check",
"test": "vitest run && echo \"manually check that there are no type errors in test/types by opening the files in there\"",
"build": "rollup -c && npm run tsd",
"prepare": "npm run build",
"build": "rollup -c && pnpm tsd",
"prepare": "pnpm build",
"generate:version": "node ./scripts/generate-version.js",
"dev": "rollup -cw",
"posttest": "agadoo src/internal/index.js",
"prepublishOnly": "npm run lint && npm run build && npm test",
"prepublishOnly": "pnpm lint && pnpm build && pnpm test",
"tsd": "node ./generate-types.js",
"lint": "eslint \"{src,test}/**/*.{ts,js}\" --cache"
},
"repository": {
"type": "git",
"url": "https://github.com/sveltejs/svelte.git",
"directory":"packages/svelte"
"directory": "packages/svelte"
},
"keywords": [
"UI",

View File

@ -5,14 +5,10 @@ import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
const require = createRequire(import.meta.url);
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
// runs the version generation as a side-effect of importing
import './scripts/generate-version.js';
// Create auto-generated .js files
fs.writeFileSync(
'./src/shared/version.js',
`/** @type {string} */\nexport const VERSION = '${pkg.version}';`
);
const require = createRequire(import.meta.url);
const internal = await import('./src/runtime/internal/index.js');
fs.writeFileSync(

View File

@ -0,0 +1,8 @@
import fs from 'node:fs';
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
fs.writeFileSync(
'./src/shared/version.js',
`// generated during release, do not modify\n\n/** @type {string} */\nexport const VERSION = '${pkg.version}';\n`
);

View File

@ -0,0 +1,4 @@
// generated during release, do not modify
/** @type {string} */
export const VERSION = '4.0.0-next.0';

View File

@ -0,0 +1,16 @@
import { fileURLToPath } from 'node:url';
import { assert, describe, it } from 'vitest';
import { VERSION } from 'svelte/compiler';
import { try_load_json } from '../helpers.js';
describe('svelte/compiler VERSION', () => {
it('should be the exact version from package.json');
const pkg = try_load_json(
fileURLToPath(new URL('../../../../packages/svelte/package.json', import.meta.url))
);
assert.equal(
VERSION,
pkg.version,
'VERSION export in src/shared/version.js does not equal version in package.json'
);
});