diff --git a/.github/workflows/experimental.yml b/.github/workflows/experimental.yml index 8edc2c417..99b346d04 100644 --- a/.github/workflows/experimental.yml +++ b/.github/workflows/experimental.yml @@ -21,7 +21,7 @@ jobs: ${{ runner.os }}-node- - run: yarn - - run: npm run set-experimental-verisons + - run: npm run set-experimental-versions - run: npm run build - run: npm run test - run: npm publish --tag experimental --dry-run diff --git a/packages/dockview-core/package.json b/packages/dockview-core/package.json index dd99ceeb3..03c7637fb 100644 --- a/packages/dockview-core/package.json +++ b/packages/dockview-core/package.json @@ -25,8 +25,7 @@ "docs": "typedoc", "rebuild": "npm run clean && npm run build", "test": "cross-env ../../node_modules/.bin/jest --selectProjects dockview-core", - "test:cov": "cross-env ../../node_modules/.bin/jest --selectProjects dockview-core --coverage", - "dev-publish": "node ./scripts/publishExperimental.js" + "test:cov": "cross-env ../../node_modules/.bin/jest --selectProjects dockview-core --coverage" }, "files": [ "dist", diff --git a/packages/dockview-core/scripts/publishExperimental.js b/packages/dockview-core/scripts/publishExperimental.js deleted file mode 100644 index efd1b8e2d..000000000 --- a/packages/dockview-core/scripts/publishExperimental.js +++ /dev/null @@ -1,63 +0,0 @@ -const cp = require('child_process'); -const fs = require('fs-extra'); -const path = require('path'); - -const rootDir = path.join(__dirname, '..'); -const publishDir = path.join(rootDir, '__publish__'); - -cp.execSync('npm run clean', { cwd: rootDir, stdio: 'inherit' }); -cp.execSync('npm run test', { cwd: __dirname, stdio: 'inherit' }); -cp.execSync('npm run build', { cwd: rootDir, stdio: 'inherit' }); - -if (fs.existsSync(publishDir)) { - fs.removeSync(publishDir); -} -fs.mkdirSync(publishDir); - -if (!fs.existsSync(path.join(publishDir, 'dist'))) { - fs.mkdirSync(path.join(publishDir, 'dist')); -} - -const package = JSON.parse( - fs.readFileSync(path.join(rootDir, 'package.json')).toString() -); - -for (const file of package.files) { - fs.copySync(path.join(rootDir, file), path.join(publishDir, file)); -} - -const result = cp - .execSync('git rev-parse --short HEAD', { - cwd: rootDir, - }) - .toString() - .replace(/\n/g, ''); - -function formatDate() { - const date = new Date(); - - function pad(value) { - if (value.toString().length === 1) { - return `0${value}`; - } - return value; - } - - return `${date.getFullYear()}${pad(date.getMonth() + 1)}${pad( - date.getDate() - )}`; -} - -package.version = `0.0.0-experimental-${result}-${formatDate()}`; -package.scripts = {}; - -fs.writeFileSync( - path.join(publishDir, 'package.json'), - JSON.stringify(package, null, 4) -); - -const command = 'npm publish --tag experimental'; - -cp.execSync(command, { cwd: publishDir, stdio: 'inherit' }); - -fs.removeSync(publishDir); diff --git a/packages/dockview/package.json b/packages/dockview/package.json index 5e4dc2edd..47ba0ea81 100644 --- a/packages/dockview/package.json +++ b/packages/dockview/package.json @@ -25,8 +25,7 @@ "prepublishOnly": "npm run rebuild && npm run test", "rebuild": "npm run clean && npm run build", "test": "cross-env ../../node_modules/.bin/jest --selectProjects dockview", - "test:cov": "cross-env ../../node_modules/.bin/jest --selectProjects dockview --coverage", - "dev-publish": "node ./scripts/publishExperimental.js" + "test:cov": "cross-env ../../node_modules/.bin/jest --selectProjects dockview --coverage" }, "files": [ "dist", diff --git a/packages/dockview/scripts/publishExperimental.js b/packages/dockview/scripts/publishExperimental.js deleted file mode 100644 index f6aa3dea1..000000000 --- a/packages/dockview/scripts/publishExperimental.js +++ /dev/null @@ -1,64 +0,0 @@ -const cp = require('child_process'); -const fs = require('fs-extra'); -const path = require('path'); - -const rootDir = path.join(__dirname, '..'); -const publishDir = path.join(rootDir, '__publish__'); - -cp.execSync('npm run clean', { cwd: rootDir, stdio: 'inherit' }); -cp.execSync('npm run test', { cwd: __dirname, stdio: 'inherit' }); -cp.execSync('npm run build', { cwd: rootDir, stdio: 'inherit' }); - -if (fs.existsSync(publishDir)) { - fs.removeSync(publishDir); -} -fs.mkdirSync(publishDir); - -if (!fs.existsSync(path.join(publishDir, 'dist'))) { - fs.mkdirSync(path.join(publishDir, 'dist')); -} - -const package = JSON.parse( - fs.readFileSync(path.join(rootDir, 'package.json')).toString() -); - -for (const file of package.files) { - fs.copySync(path.join(rootDir, file), path.join(publishDir, file)); -} - -const result = cp - .execSync('git rev-parse --short HEAD', { - cwd: rootDir, - }) - .toString() - .replace(/\n/g, ''); - -function formatDate() { - const date = new Date(); - - function pad(value) { - if (value.toString().length === 1) { - return `0${value}`; - } - return value; - } - - return `${date.getFullYear()}${pad(date.getMonth() + 1)}${pad( - date.getDate() - )}`; -} - -package.version = `0.0.0-experimental-${result}-${formatDate()}`; -package.dependencies['dockview-core'] = package.version; -package.scripts = {}; - -fs.writeFileSync( - path.join(publishDir, 'package.json'), - JSON.stringify(package, null, 4) -); - -const command = 'npm publish --tag experimental'; - -cp.execSync(command, { cwd: publishDir, stdio: 'inherit' }); - -fs.removeSync(publishDir); diff --git a/scripts/set-experimental-versions.js b/scripts/set-experimental-versions.js index 4ae911dc2..537812f5f 100644 --- a/scripts/set-experimental-versions.js +++ b/scripts/set-experimental-versions.js @@ -59,3 +59,13 @@ dockviewPackageJson.version = version; dockviewPackageJson.dependencies['dockview-core'] = dockviewPackageJson.version; fs.writeFileSync(dockviewPath, JSON.stringify(dockviewPackageJson, null, 4)); + +// sanity check + +const dvCore = JSON.parse(fs.readFileSync(dockviewCorePath).toString()); +const dv = JSON.parse(fs.readFileSync(dockviewPath).toString()); + +console.log(`dockview-core version: ${dvCore.version}`); +console.log( + `dockview version: ${dv.version} dockview-core dependency version: ${dv.dependencies['dockview-core']}` +);