Skip to content

Commit

Permalink
fix(nx): include typescript in the create-nx-workspace sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored and vsavkin committed May 15, 2019
1 parent a7fa8bf commit f070ce7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/create-nx-workspace/bin/create-nx-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ const tmpDir = dirSync().name;

const nxVersion = 'NX_VERSION';
const cliVersion = 'ANGULAR_CLI_VERSION';
const typescriptVersion = 'TYPESCRIPT_VERSION';

writeFileSync(
path.join(tmpDir, 'package.json'),
JSON.stringify({
dependencies: {
[nxTool.packageName]: nxVersion,
'@angular/cli': cliVersion
'@angular/cli': cliVersion,
typescript: typescriptVersion
},
license: 'MIT'
})
Expand Down
4 changes: 3 additions & 1 deletion packages/workspace/bin/create-nx-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ const tmpDir = dirSync().name;

const nxVersion = 'NX_VERSION';
const cliVersion = 'ANGULAR_CLI_VERSION';
const typescriptVersion = 'TYPESCRIPT_VERSION';

writeFileSync(
path.join(tmpDir, 'package.json'),
JSON.stringify({
dependencies: {
[nxTool.packageName]: nxVersion,
'@angular/cli': cliVersion
'@angular/cli': cliVersion,
typescript: typescriptVersion
},
license: 'MIT'
})
Expand Down
8 changes: 5 additions & 3 deletions scripts/nx-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,16 @@ if (!parsedVersion.isValid) {
console.log('parsed version: ', JSON.stringify(parsedVersion));
}

const cliVersion = JSON.parse(
const { devDependencies } = JSON.parse(
fs.readFileSync(path.join(__dirname, '../package.json'))
).devDependencies['@angular/cli'];
);
const cliVersion = devDependencies['@angular/cli'];
const typescriptVersion = devDependencies['typescript'];

console.log('Executing build script:');
const buildCommand = `./scripts/package.sh ${
parsedVersion.version
} ${cliVersion}`;
} ${cliVersion} ${typescriptVersion}`;
console.log(`> ${buildCommand}`);
childProcess.execSync(buildCommand, {
stdio: [0, 1, 2]
Expand Down
3 changes: 3 additions & 0 deletions scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

NX_VERSION=$1
ANGULAR_CLI_VERSION=$2
TYPESCRIPT_VERSION=$3

if [[ $NX_VERSION == "--local" ]]; then
NX_VERSION="*"
Expand All @@ -19,8 +20,10 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "s|\*|$NX_VERSION|g" {schematics,react,web,jest,node,express,nest,cypress,angular,workspace}/package.json
sed -i "" "s|NX_VERSION|$NX_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
sed -i "" "s|ANGULAR_CLI_VERSION|$ANGULAR_CLI_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
sed -i "" "s|TYPESCRIPT_VERSION|$TYPESCRIPT_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
sed -i "" "s|NX_VERSION|$NX_VERSION|g" workspace/bin/create-nx-workspace.js
sed -i "" "s|ANGULAR_CLI_VERSION|$ANGULAR_CLI_VERSION|g" workspace/bin/create-nx-workspace.js
sed -i "" "s|TYPESCRIPT_VERSION|$TYPESCRIPT_VERSION|g" workspace/bin/create-nx-workspace.js
else
sed -i "s|exports.nxVersion = '\*';|exports.nxVersion = '$NX_VERSION';|g" {react,web,jest,node,express,nest,cypress,angular,workspace}/src/utils/versions.js
sed -i "s|\*|$NX_VERSION|g" {schematics,react,web,jest,node,express,nest,cypress,angular,workspace}/package.json
Expand Down

0 comments on commit f070ce7

Please sign in to comment.