-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
115 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
scripts/class_migration/copy_generated_candid_from_example.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
#!/usr/bin/env node | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
require('ts-node').register({ | ||
transpileOnly: true, | ||
ignore: [`node_modules/(?!azle)`], | ||
compilerOptions: { | ||
module: 'commonjs', | ||
allowJs: true | ||
} | ||
}); | ||
require('./main.ts'); | ||
import 'tsx'; | ||
import('./main.ts'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
#!/usr/bin/env node | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
require('ts-node').register({ | ||
transpileOnly: true, | ||
ignore: [`node_modules/(?!azle)`], | ||
compilerOptions: { | ||
module: 'commonjs', | ||
allowJs: true | ||
} | ||
}); | ||
require('./main.ts'); | ||
import 'tsx'; | ||
import('./main.ts'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* eslint-disable @typescript-eslint/explicit-function-return-type */ | ||
|
||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
|
||
// Path to the package.json file | ||
const packageJsonPath = path.join(process.cwd(), 'package.json'); | ||
|
||
// Helper function to sort an object by its keys | ||
const sortObjectByKeys = (obj) => { | ||
return Object.keys(obj) | ||
.sort() | ||
.reduce((result, key) => { | ||
result[key] = obj[key]; | ||
return result; | ||
}, {}); | ||
}; | ||
|
||
// Read and parse package.json | ||
fs.readFile(packageJsonPath, 'utf8', (err, data) => { | ||
if (err) { | ||
console.error(`Error reading package.json file: ${err}`); | ||
return; | ||
} | ||
|
||
let packageJson; | ||
try { | ||
packageJson = JSON.parse(data); | ||
} catch (parseErr) { | ||
console.error(`Error parsing package.json: ${parseErr}`); | ||
return; | ||
} | ||
|
||
const tsxVersion = '^4.15.7'; | ||
let tsNodeRemoved = false; | ||
|
||
// Check and update dependencies | ||
if (packageJson.dependencies && packageJson.dependencies['ts-node']) { | ||
delete packageJson.dependencies['ts-node']; | ||
packageJson.dependencies['tsx'] = tsxVersion; | ||
packageJson.dependencies = sortObjectByKeys(packageJson.dependencies); | ||
tsNodeRemoved = true; | ||
} | ||
|
||
// Check and update devDependencies | ||
if (packageJson.devDependencies && packageJson.devDependencies['ts-node']) { | ||
delete packageJson.devDependencies['ts-node']; | ||
packageJson.devDependencies['tsx'] = tsxVersion; | ||
packageJson.devDependencies = sortObjectByKeys( | ||
packageJson.devDependencies | ||
); | ||
tsNodeRemoved = true; | ||
} | ||
|
||
if (!tsNodeRemoved) { | ||
console.log('ts-node not found in dependencies or devDependencies.'); | ||
return; | ||
} | ||
|
||
// Write the updated package.json back to the file | ||
fs.writeFile( | ||
packageJsonPath, | ||
JSON.stringify(packageJson, null, 2), | ||
'utf8', | ||
(writeErr) => { | ||
if (writeErr) { | ||
console.error( | ||
`Error writing updated package.json: ${writeErr}` | ||
); | ||
return; | ||
} | ||
|
||
console.log('package.json successfully updated.'); | ||
} | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters