diff --git a/common/changes/just-scripts/upgrade_2019-04-10-22-37.json b/common/changes/just-scripts/upgrade_2019-04-10-22-37.json new file mode 100644 index 00000000..50278eaf --- /dev/null +++ b/common/changes/just-scripts/upgrade_2019-04-10-22-37.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "just-scripts", + "comment": "make the just-stack.json write out to a specific installed version of stack", + "type": "patch" + } + ], + "packageName": "just-scripts", + "email": "kchau@microsoft.com" +} \ No newline at end of file diff --git a/common/changes/just-stack-single-lib/upgrade_2019-04-11-18-05.json b/common/changes/just-stack-single-lib/upgrade_2019-04-11-18-05.json new file mode 100644 index 00000000..23c6e964 --- /dev/null +++ b/common/changes/just-stack-single-lib/upgrade_2019-04-11-18-05.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "just-stack-single-lib", + "comment": "make tsconfig only include src files in the generated packages", + "type": "patch" + } + ], + "packageName": "just-stack-single-lib", + "email": "kchau@microsoft.com" +} \ No newline at end of file diff --git a/common/changes/just-stack-uifabric/upgrade_2019-04-11-18-05.json b/common/changes/just-stack-uifabric/upgrade_2019-04-11-18-05.json new file mode 100644 index 00000000..e08274aa --- /dev/null +++ b/common/changes/just-stack-uifabric/upgrade_2019-04-11-18-05.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "just-stack-uifabric", + "comment": "make tsconfig only include src files in the generated packages", + "type": "patch" + } + ], + "packageName": "just-stack-uifabric", + "email": "kchau@microsoft.com" +} \ No newline at end of file diff --git a/packages/just-scripts/src/stack/lockfile.ts b/packages/just-scripts/src/stack/lockfile.ts index ba31b3d0..df6639dd 100644 --- a/packages/just-scripts/src/stack/lockfile.ts +++ b/packages/just-scripts/src/stack/lockfile.ts @@ -1,15 +1,31 @@ import { getAvailableStacks } from './getAvailableStacks'; import path from 'path'; import fs from 'fs'; +import { readPackageJson } from 'just-scripts-utils'; +import { resolve } from 'just-task'; export function writeLockFile(rootPath: string) { const stacks = getAvailableStacks(rootPath); - const lockFile = path.join(rootPath, 'scripts', 'just-stacks.json'); - fs.writeFileSync(lockFile, JSON.stringify({ stacks }, null, 2)); + + const resolvedStacks: { [key: string]: string } = {}; + Object.keys(stacks).forEach(stack => { + const packageJsonPath = resolve(stack + '/package.json', path.join(rootPath, 'scripts')); + + if (packageJsonPath) { + const packageJson = readPackageJson(path.dirname(packageJsonPath)); + + if (packageJson) { + resolvedStacks[stack] = packageJson.version; + } + } + }); + + const lockFile = path.join(rootPath, 'just-stacks.json'); + fs.writeFileSync(lockFile, JSON.stringify({ stacks: resolvedStacks }, null, 2)); } export function readLockFile(rootPath: string) { - const lockFile = path.join(rootPath, 'scripts', 'just-stacks.json'); + const lockFile = path.join(rootPath, 'just-stacks.json'); if (!fs.existsSync(lockFile)) { return null; } diff --git a/packages/just-scripts/src/tasks/upgradeRepoTask.ts b/packages/just-scripts/src/tasks/upgradeRepoTask.ts index 814f48e5..f97656ac 100644 --- a/packages/just-scripts/src/tasks/upgradeRepoTask.ts +++ b/packages/just-scripts/src/tasks/upgradeRepoTask.ts @@ -10,11 +10,14 @@ import { applyStackDiffs } from '../monorepo/applyStackDiffs'; export function upgradeRepoTask(): TaskFunction { return async function upgradeRepo() { const rootPath = findMonoRepoRootPath(); + if (!rootPath) { logger.error('Could not find monorepo root path. Not upgrading anything.'); return; } + const scriptsPath = path.join(rootPath, 'scripts'); + const oldStacks = readLockFile(rootPath); if (oldStacks) { diff --git a/packages/just-stack-single-lib/template/tsconfig.json b/packages/just-stack-single-lib/template/tsconfig.json index aeec3faa..52cc6f42 100644 --- a/packages/just-stack-single-lib/template/tsconfig.json +++ b/packages/just-stack-single-lib/template/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "esnext", + "target": "es2015", "module": "commonjs", "declaration": true, "declarationMap": true, @@ -9,6 +9,8 @@ "downlevelIteration": true, "strict": true, "moduleResolution": "node", + "allowSyntheticDefaultImports": true, "esModuleInterop": true - } + }, + "include": ["src/**/*"] } diff --git a/packages/just-stack-uifabric/template/tsconfig.json b/packages/just-stack-uifabric/template/tsconfig.json index 220b6c05..56a7161a 100644 --- a/packages/just-stack-uifabric/template/tsconfig.json +++ b/packages/just-stack-uifabric/template/tsconfig.json @@ -1,12 +1,15 @@ { "compilerOptions": { - "target": "esnext", - "module": "commonjs", + "target": "es5", + "module": "es2015", "outDir": "./lib", "importHelpers": true, "downlevelIteration": true, "strict": true, "moduleResolution": "node", - "esModuleInterop": true - } + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "jsx": "react" + }, + "include": ["src/**/*"] }