Compare commits

...

1 commit

Author SHA1 Message Date
Mary Guillemard
f685f31730 Switch to NPM lock files and rewrite nixpkg
This prepare for flake rewrite

Signed-off-by: Mary Guillemard <mary@mary.zone>
2024-01-01 15:34:03 +00:00
9 changed files with 3100 additions and 1970 deletions

View file

@ -15,17 +15,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: latest
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version-file: ".nvmrc" node-version-file: ".nvmrc"
cache: "pnpm" cache: "npm"
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: npm ci
- name: Run ESLint - name: Run ESLint
run: node_modules/.bin/eslint . run: node_modules/.bin/eslint .
@ -35,17 +31,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: latest
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version-file: ".nvmrc" node-version-file: ".nvmrc"
cache: "pnpm" cache: "npm"
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: npm ci
- name: Run Prettier - name: Run Prettier
run: node_modules/.bin/prettier -c . run: node_modules/.bin/prettier -c .
@ -55,17 +47,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: latest
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version-file: ".nvmrc" node-version-file: ".nvmrc"
cache: "pnpm" cache: "npm"
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: npm ci
- name: Build package - name: Build package
run: pnpm build run: npm run build

View file

@ -19,14 +19,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: latest
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version-file: ".nvmrc" node-version-file: ".nvmrc"
cache: "pnpm" cache: "npm"
- name: Configure git - name: Configure git
run: | run: |
@ -34,7 +30,7 @@ jobs:
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: npm ci
- name: Run ESLint - name: Run ESLint
run: node_modules/.bin/eslint --fix . run: node_modules/.bin/eslint --fix .
@ -58,14 +54,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: latest
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version-file: ".nvmrc" node-version-file: ".nvmrc"
cache: "pnpm" cache: "npm"
- name: Configure git - name: Configure git
run: | run: |
@ -73,7 +65,7 @@ jobs:
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: npm ci
- name: Run Prettier - name: Run Prettier
run: node_modules/.bin/prettier -w . run: node_modules/.bin/prettier -w .

View file

@ -2,5 +2,5 @@ dist/
public/ public/
*.js *.js
.github/ .github/
pnpm-lock.yaml package-lock.json
nodemon.json nodemon.json

View file

@ -3,7 +3,6 @@ FROM node:lts-hydrogen as common
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH=$PATH:/home/node/.npm-global/bin ENV PATH=$PATH:/home/node/.npm-global/bin
RUN npm i -g pnpm
WORKDIR /home/node/app WORKDIR /home/node/app
@ -11,14 +10,14 @@ FROM common as build
COPY . /home/node/app COPY . /home/node/app
RUN pnpm install --frozen-lockfile RUN npm ci
RUN pnpm build RUN npm run build
FROM common as app FROM common as app
COPY --from=build --chown=node:node /home/node/app/dist /home/node/app/dist COPY --from=build --chown=node:node /home/node/app/dist /home/node/app/dist
COPY --from=build --chown=node:node /home/node/app/public /home/node/app/public COPY --from=build --chown=node:node /home/node/app/public /home/node/app/public
COPY --from=build --chown=node:node /home/node/app/package.json /home/node/app/pnpm-lock.yaml /home/node/app/ COPY --from=build --chown=node:node /home/node/app/package.json /home/node/app/package-lock.json /home/node/app/
COPY --from=build --chown=node:node /home/node/app/node_modules /home/node/app/node_modules COPY --from=build --chown=node:node /home/node/app/node_modules /home/node/app/node_modules
RUN mkdir /home/node/app/data RUN mkdir /home/node/app/data

View file

@ -1,46 +1,28 @@
{ pkgs ? (import <nixpkgs> {})}: { pkgs ? (import <nixpkgs> {})}:
with pkgs; with pkgs;
with (import (fetchFromGitHub {
owner = "TSRBerry";
repo = "pnpm2nix";
rev = "8df6e2a8bd0174f4e9fa858d37c08ff3e91019bc";
sha256 = "YhWzfuqNCZmKMbcoDoAT52KodjpuNj/7MklwKD0ojrg=";
}) { inherit pkgs; });
let let
buildPackage = mkPnpmPackage { package = buildNpmPackage {
src = nix-gitignore.gitignoreSource [] ./.; pname = "ryujinx-ldn-website";
version = "1.0.0";
linkDevDependencies = true; #linkDevDependencies = true;
postBuild = '' src = ./.;
cp -R "node_modules/$pname"/* ./
export PATH="node_modules/.bin:$PATH" npmBuildScript = "release";
npmBuildFlags = [ "--" "--outDir" "dist" ];
installPhase = ''
runHook preInstall
cp -r dist $out/
cp -r public package.json package-lock.json node_modules $out/
mkdir -p "$out/dist" makeWrapper '${nodejs}/bin/node' "$out/bin/ryujinx-ldn-website" --add-flags "$out/index.js"
npm run build -- --outDir "$out/dist" runHook postInstall
mv public package.json pnpm-lock.yaml "$out/"
''; '';
postInstall = '' npmDepsHash = "sha256-Wo4dGsUAZwXbkuWwTKNA5kv4ZUnekdKm/TagP4Q4Ds8=";
rm -rf "$out/bin" "$lib/node_modules/$pname"
'';
};
package = mkPnpmPackage {
src = buildPackage;
postInstall = ''
mv "$lib/node_modules/$pname/dist" "$lib/node_modules/$pname/public" "$lib/node_modules/$pname/package.json" "$out/"
rm -rf "$lib/node_modules/$pname"
ln -s "$lib/node_modules" "$out/node_modules"
ln -s "$npm_config_nodedir/bin/node" "$out/bin/node"
'';
}; };
in package in package

View file

@ -9,5 +9,5 @@
"views" "views"
], ],
"ext": "ts,js,html,css,ejs,png", "ext": "ts,js,html,css,ejs,png",
"exec": "pnpm run dev" "exec": "npm run dev"
} }

3066
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -13,11 +13,12 @@
"format": "prettier -w .", "format": "prettier -w .",
"lint": "eslint --fix .", "lint": "eslint --fix .",
"build": "tsc", "build": "tsc",
"prestart": "pnpm build", "prestart": "npm build",
"start": "node .", "start": "node .",
"dev": "pnpm build && pnpm start", "dev": "npm build && npm start",
"serve": "nodemon", "serve": "nodemon",
"prepack": "pnpm build" "prepack": "npm build",
"release": "tsc"
}, },
"dependencies": { "dependencies": {
"ejs": "^3.1.9", "ejs": "^3.1.9",

File diff suppressed because it is too large Load diff