-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Extract some packages from the main repository (#17)
- Loading branch information
Showing
21 changed files
with
266 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# @swc/counter | ||
|
||
## 0.1.3 | ||
|
||
### Patch Changes | ||
|
||
- a87f28d: Refactoring for @swc/counter |
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,7 @@ | ||
# @swc/couter | ||
|
||
Download counter for swc packages. | ||
|
||
This package does not contain any code. It is used solely to track number of downloads of npm packages like `@swc/core` and `@next/swc`. If you are building a huge project using SWC, please consider depending on this package. It will not add any code to your bundle, but it will help us determine the number of users of SWC. | ||
|
||
Counting is done by npm, just like other packages. |
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 @@ | ||
console.log("download-counter/index.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "@swc/counter", | ||
"packageManager": "pnpm@8.6.7", | ||
"main": "index.js", | ||
"version": "0.1.3", | ||
"description": "Downloade counter for the swc project", | ||
"sideEffects": false, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/swc-project/pkgs.git" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/", | ||
"access": "public" | ||
}, | ||
"keywords": [ | ||
"swc", | ||
"download", | ||
"counter" | ||
], | ||
"author": "강동윤 <kdy1997.dev@gmail.com>", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/swc-project/swc/issues" | ||
}, | ||
"homepage": "https://swc.rs" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
yarn.lock | ||
node_modules | ||
_/ | ||
*.tgz | ||
lib/*.js | ||
tests/*.js | ||
*.d.ts | ||
*.map |
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,10 @@ | ||
examples/ | ||
node_modules/ | ||
package-lock.json | ||
*.log | ||
.swcrc | ||
.yarn | ||
*.tgz | ||
.dprint.json | ||
out/ | ||
tests/ |
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,7 @@ | ||
# swc-info | ||
|
||
## 0.1.16 | ||
|
||
### Patch Changes | ||
|
||
- a87f28d: Refactoring for @swc/counter |
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,9 @@ | ||
# swc-info | ||
|
||
## Usage | ||
|
||
```sh | ||
npx -y swc-info@latest | ||
``` | ||
|
||
then copy the output to the issue;. |
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,2 @@ | ||
#!/usr/bin/env node | ||
require("../lib/index.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import os from "node:os"; | ||
import process from "node:process"; | ||
import childProcess from "child_process"; | ||
import { createRequire } from "node:module"; | ||
|
||
const localRequire = createRequire(`${process.cwd()}/[eval]`); | ||
|
||
function getUniqueCpuNames(): string { | ||
return os | ||
.cpus() | ||
.map((cpu) => cpu.model) | ||
.filter((model, index, models) => models.indexOf(model) === index) | ||
.join(", "); | ||
} | ||
|
||
function getBinaryVersion(binaryName: string): string { | ||
try { | ||
return childProcess | ||
.execFileSync(binaryName, ["--version"]) | ||
.toString() | ||
.trim(); | ||
} catch { | ||
return "N/A"; | ||
} | ||
} | ||
|
||
function getPackageVersion(packageName: string) { | ||
try { | ||
return localRequire(`${packageName}/package.json`).version; | ||
} catch { | ||
return null; | ||
} | ||
} | ||
|
||
function interestingPackage(name: string): string | null { | ||
const version = getPackageVersion(name); | ||
if (version) { | ||
return `${name}: ${version}`; | ||
} else { | ||
return null; | ||
} | ||
} | ||
function interestingPackages(names: string[]): string { | ||
return names.map(interestingPackage).filter(Boolean).join("\n "); | ||
} | ||
|
||
console.log(` | ||
Operating System: | ||
Platform: ${os.platform()} | ||
Arch: ${os.arch()} | ||
Machine Type: ${os.machine()} | ||
Version: ${os.version()} | ||
CPU: (${os.cpus().length} cores) | ||
Models: ${getUniqueCpuNames()} | ||
Binaries: | ||
Node: ${process.versions.node} | ||
npm: ${getBinaryVersion("npm")} | ||
Yarn: ${getBinaryVersion("yarn")} | ||
pnpm: ${getBinaryVersion("pnpm")} | ||
Relevant Packages: | ||
@swc/core: ${getPackageVersion("@swc/core") ?? "N/A"} | ||
@swc/helpers: ${getPackageVersion("@swc/helpers") ?? "N/A"} | ||
@swc/types: ${getPackageVersion("@swc/types") ?? "N/A"} | ||
${interestingPackages(["typescript", "next"])} | ||
SWC Config: | ||
output: N/A | ||
.swcrc path: N/A | ||
Next.js info: | ||
output: N/A | ||
`); |
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,35 @@ | ||
{ | ||
"name": "swc-info", | ||
"packageManager": "pnpm@8.6.7", | ||
"version": "0.1.16", | ||
"description": "CLI tool to help issue reporting for swc", | ||
"sideEffects": false, | ||
"scripts": { | ||
"build": "tsc", | ||
"prepublishOnly": "yarn build", | ||
"prepack": "yarn build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/swc-project/pkgs.git" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/", | ||
"access": "public" | ||
}, | ||
"keywords": [ | ||
"swc", | ||
"info", | ||
"cli" | ||
], | ||
"author": "강동윤 <kdy1997.dev@gmail.com>", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/swc-project/swc/issues" | ||
}, | ||
"homepage": "https://swc.rs", | ||
"devDependencies": { | ||
"typescript": "^5.2.2" | ||
}, | ||
"bin": "bin/swc-info.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2019", | ||
"useDefineForClassFields": true, | ||
"module": "commonjs", | ||
"baseUrl": "./", | ||
"paths": {}, | ||
"resolveJsonModule": true, | ||
"declaration": true, | ||
"sourceMap": true, | ||
"downlevelIteration": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"rootDir": "." | ||
}, | ||
"include": ["lib", "tests"], | ||
"exclude": ["examples"] | ||
} |
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
Oops, something went wrong.