New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@okamjs/okam

Package Overview
Dependencies
Maintainers
3
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@okamjs/okam - npm Package Compare versions

Comparing version 0.0.31-dev.20231104.1 to 0.0.31-dev.20231105.1

8

package.json
{
"name": "@okamjs/okam",
"version": "0.0.31-dev.20231104.1",
"version": "0.0.31-dev.20231105.1",
"main": "index.js",

@@ -39,6 +39,6 @@ "types": "index.d.ts",

"optionalDependencies": {
"@okamjs/okam-darwin-arm64": "0.0.31-dev.20231104.1",
"@okamjs/okam-darwin-x64": "0.0.31-dev.20231104.1",
"@okamjs/okam-linux-x64-gnu": "0.0.31-dev.20231104.1"
"@okamjs/okam-darwin-arm64": "0.0.31-dev.20231105.1",
"@okamjs/okam-darwin-x64": "0.0.31-dev.20231105.1",
"@okamjs/okam-linux-x64-gnu": "0.0.31-dev.20231105.1"
}
}
import 'zx/globals';
import * as process from 'process';
(async () => {
// console.log('Check branch');
// const branch = (await $`git branch --show-current`).stdout.trim();
// if (branch !== 'master') {
// throw new Error('Please run this script in master branch');
// }
//
// // Check git status
// console.log('Check git status');
// const status = (await $`git status --porcelain`).stdout.trim();
// if (status) {
// throw new Error('Please commit all changes before release');
// }
//
// bump version
console.log('Bump version');
const nodePkgDir = path.resolve(__dirname, '..');
const nodePkgPath = path.join(nodePkgDir, 'package.json');
const nodePkg = JSON.parse(fs.readFileSync(nodePkgPath, 'utf-8'));
const currentVersion = nodePkg.version;
console.log('Check branch');
const branch = (await $`git branch --show-current`).stdout.trim();
if (branch !== 'master') {
throw new Error('Please run this script in master branch');
}
console.log('current version: ', currentVersion);
const newVersion = (await question(`What's next version? `)).trim();
// Check git status
console.log('Check git status');
const status = (await $`git status --porcelain`).stdout.trim();
if (status) {
throw new Error('Please commit all changes before release');
}
let tag = 'latest';
if (
newVersion.includes('-alpha.') ||
newVersion.includes('-beta.') ||
newVersion.includes('-rc.')
)
tag = 'next';
if (newVersion.includes('-canary.')) tag = 'canary';
if (newVersion.includes('-dev.')) tag = 'dev';
// bump version
console.log('Bump version');
const nodePkgDir = path.resolve(__dirname, '..');
const nodePkgPath = path.join(nodePkgDir, 'package.json');
const nodePkg = JSON.parse(fs.readFileSync(nodePkgPath, 'utf-8'));
const currentVersion = nodePkg.version;
if (tag !== 'dev' && tag !== 'canary') {
console.error('Please specify version like x.y.z-canary.n or x.y.z-dev.n');
throw Error('Only dev and canary tags are allowed');
}
console.log('current version: ', currentVersion);
const newVersion = (await question(`What's next version? `)).trim();
nodePkg.version = newVersion;
let tag = 'latest';
if (
newVersion.includes('-alpha.') ||
newVersion.includes('-beta.') ||
newVersion.includes('-rc.')
)
tag = 'next';
if (newVersion.includes('-canary.')) tag = 'canary';
if (newVersion.includes('-dev.')) tag = 'dev';
console.log(`${nodePkg.name}@${newVersion} will be published`);
const willContinue = ((await question('Continue? y/[n]')) || 'n').trim();
if (tag !== 'dev' && tag !== 'canary') {
console.error('Please specify version like x.y.z-canary.n or x.y.z-dev.n');
throw Error('Only dev and canary tags are allowed');
}
if (willContinue !== 'y') {
console.log('Abort!');
process.exit(0);
}
nodePkg.version = newVersion;
fs.writeFileSync(nodePkgPath, JSON.stringify(nodePkg, null, 2) + '\n');
console.log(`${nodePkg.name}@${newVersion} will be published`);
const willContinue = ((await question('Continue? y/[n]')) || 'n').trim();
// build macOs *.node
await $`rm -rf ./*.node`;
await $`pnpm run build:mac:x86`;
await $`pnpm run build:mac:aarch`;
await $`strip -x ./okam.darwin-*.node`;
if (willContinue !== 'y') {
console.log('Abort!');
process.exit(0);
}
await build_linux_binding();
fs.writeFileSync(nodePkgPath, JSON.stringify(nodePkg, null, 2) + '\n');
// ref https://gist.github.com/shqld/256e2c4f4b97957fb0ec250cdc6dc463
// $.env.CC_X86_64_UNKNOWN_LINUX_GNU = 'x86_64-unknown-linux-gnu-gcc';
// $.env.CXX_X86_64_UNKNOWN_LINUX_GNU = 'x86_64-unknown-linux-gnu-g++';
// $.env.AR_X86_64_UNKNOWN_LINUX_GNU = 'x86_64-unknown-linux-gnu-ar';
// $.env.CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER =
// 'x86_64-unknown-linux-gnu-gcc';
// await $`pnpm run build:linux:x86`;
// await $`docker run --rm -v $PWD:/workspace -w /workspace ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian bash -c "strip okam.linux-x64-gnu.node"`;
// build macOs *.node
await $`rm -rf ./*.node`;
await $`pnpm run build:mac:x86`;
await $`pnpm run build:mac:aarch`;
await $`strip -x ./okam.darwin-*.node`;
await $`pnpm run artifacts:local`;
await build_linux_binding();
// --ignore-scripts because we don't publish optional pkg
await $`npm publish --tag ${tag} --access public`;
await $`pnpm run artifacts:local`;
// set new version to bundler-okam
console.log('Set new version to bundler-okam');
const bundlerOkamPkgPath = path.join(
__dirname,
'../../../packages/bundler-okam/package.json',
);
const bundlerOkamPkg = JSON.parse(
fs.readFileSync(bundlerOkamPkgPath, 'utf-8'),
);
bundlerOkamPkg.dependencies['@okamjs/okam'] = `${newVersion}`;
fs.writeFileSync(
bundlerOkamPkgPath,
JSON.stringify(bundlerOkamPkg, null, 2) + '\n',
);
// --ignore-scripts because we don't publish optional pkg
await $`npm publish --tag ${tag} --access public`;
// await $`git commit -a -m "release: ${nodePkg.name}@${newVersion}"`;
// // tag
// console.log('Tag');
// await $`git tag v${newVersion}`;
//
// // push
// console.log('Push');
// await $`git push origin ${branch} --tags`;
// set new version to bundler-okam
console.log('Set new version to bundler-okam');
const bundlerOkamPkgPath = path.join(
__dirname,
'../../../packages/bundler-okam/package.json',
);
const bundlerOkamPkg = JSON.parse(
fs.readFileSync(bundlerOkamPkgPath, 'utf-8'),
);
bundlerOkamPkg.dependencies['@okamjs/okam'] = `${newVersion}`;
fs.writeFileSync(
bundlerOkamPkgPath,
JSON.stringify(bundlerOkamPkg, null, 2) + '\n',
);
await $`git commit -a -m "release: ${nodePkg.name}@${newVersion}"`;
// tag
console.log('Tag');
await $`git tag v${newVersion}`;
// push
console.log('Push');
await $`git push origin ${branch} --tags`;
})().catch((e) => {
console.error(e);
process.exit(1);
console.error(e);
process.exit(1);
});
async function build_linux_binding() {
const isArm = process.arch === 'arm64';
const isArm = process.arch === 'arm64';
const cargoBase = path.join(
process.env['CARGO_HOME'] || process.env['HOME'],
'.cargo',
);
const cargoBase = path.join(process.env['CARGO_HOME'] || process.env['HOME'], '.cargo')
const cargoMapOption = (p) => [
'-v',
`${path.join(cargoBase, p)}:${path.join('/usr/local/cargo', p)}`,
];
const cargoMapOption = (p) => ['-v', `${path.join(cargoBase, p)}:${path.join('/usr/local/cargo', p)}`]
const makoRoot = path.join(__dirname, '../../..');
const makoRoot = path.join(__dirname, '../../..')
const volumeOptions = [
...cargoMapOption('config'),
...cargoMapOption('git/db'),
...cargoMapOption('registry/cache'),
...cargoMapOption('registry/index'),
...[`-v`, `${makoRoot}:/build`],
...[`-w`, `/build`],
];
const containerCMD = [
'cargo build -r',
'pnpm --filter @okamjs/okam build',
'strip ./crates/node/okam.linux*.node',
].join('&&');
const volumeOptions = [
...cargoMapOption('config'),
...cargoMapOption('git/db'),
...cargoMapOption('registry/cache'),
...cargoMapOption('registry/index'),
`-v`, `${makoRoot}:/build`,
`-w`, `/build`
]
const envOptions = [];
if (process.env['RUSTUP_DIST_SERVER']) {
envOptions.push(
...['-e', `RUSTUP_DIST_SERVER=${process.env['RUSTUP_DIST_SERVER']}`],
);
}
const containerCMD = [
'cargo build -r',
'pnpm --filter @okamjs/okam build',
'strip ./crates/node/okam.linux*.node'
].join('&&')
if (process.env[`RUSTUP_UPDATE_ROOT`]) {
envOptions.push(
...['-e', `RUSTUP_UPDATE_ROOT=${process.env[`RUSTUP_UPDATE_ROOT`]}`],
);
}
const options = ['--rm', ...volumeOptions, ...envOptions];
if (isArm) {
options.push(...['--platform', 'linux/amd64']);
}
const options = [
'--rm', ...volumeOptions]
if (isArm) {
options.push('--platform')
options.push('linux/amd64')
}
const image = 'ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian';
const image = 'ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian';
await $`docker run ${options} ${image} bash -c ${containerCMD}`
}
// too many <jemalloc> log, so we use quiet
await $`docker run ${options} ${image} bash -c ${containerCMD}`.quiet();
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc