Switch back to NPM, optimize Dockerfile

This commit is contained in:
Max Isom 2020-10-24 15:19:35 -04:00
parent f941dbbddd
commit a51c712da8
No known key found for this signature in database
GPG key ID: 25C9B1A7F6798880
21 changed files with 4043 additions and 20427 deletions

View file

@ -2,5 +2,5 @@ node_modules
data
dist
dts
yarn-error.log
.env
Dockerfile

8
.gitignore vendored
View file

@ -3,14 +3,6 @@ data
dist
dts
# Yarn
.yarn/*
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
# Logs
logs
*.log

15623
.pnp.js generated

File diff suppressed because one or more lines are too long

View file

@ -1,6 +0,0 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint"
]
}

View file

@ -1,9 +0,0 @@
{
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"eslint.nodePath": ".yarn/sdks",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}

File diff suppressed because one or more lines are too long

View file

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve, dirname} = require(`path`);
const relPnpApiPath = "../../../../.pnp.js";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}
}
// Defer to the real eslint/bin/eslint.js your application uses
module.exports = absRequire(`eslint/bin/eslint.js`);

View file

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve, dirname} = require(`path`);
const relPnpApiPath = "../../../../.pnp.js";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/lib/api.js
require(absPnpApiPath).setup();
}
}
// Defer to the real eslint/lib/api.js your application uses
module.exports = absRequire(`eslint/lib/api.js`);

View file

@ -1,6 +0,0 @@
{
"name": "eslint",
"version": "7.12.0-pnpify",
"main": "./lib/api.js",
"type": "commonjs"
}

View file

@ -1,5 +0,0 @@
# This file is automatically generated by PnPify.
# Manual changes will be lost!
integrations:
- vscode

View file

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve, dirname} = require(`path`);
const relPnpApiPath = "../../../../.pnp.js";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsc
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/bin/tsc your application uses
module.exports = absRequire(`typescript/bin/tsc`);

View file

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve, dirname} = require(`path`);
const relPnpApiPath = "../../../../.pnp.js";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsserver
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/bin/tsserver your application uses
module.exports = absRequire(`typescript/bin/tsserver`);

View file

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve, dirname} = require(`path`);
const relPnpApiPath = "../../../../.pnp.js";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsc.js
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/lib/tsc.js your application uses
module.exports = absRequire(`typescript/lib/tsc.js`);

View file

@ -1,77 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve, dirname} = require(`path`);
const relPnpApiPath = "../../../../.pnp.js";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const moduleWrapper = tsserver => {
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
// doesn't understand. This layer makes sure to remove the protocol
// before forwarding it to TS, and to add it back on all returned paths.
const {isAbsolute} = require(`path`);
const Session = tsserver.server.Session;
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
let isVSCode = false;
return Object.assign(Session.prototype, {
onMessage(/** @type {string} */ message) {
const parsedMessage = JSON.parse(message)
if (
parsedMessage != null &&
typeof parsedMessage === 'object' &&
parsedMessage.arguments &&
parsedMessage.arguments.hostInfo === 'vscode'
) {
isVSCode = true;
}
return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => {
return typeof value === 'string' ? removeZipPrefix(value) : value;
}));
},
send(/** @type {any} */ msg) {
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
return typeof value === 'string' ? addZipPrefix(value) : value;
})));
}
});
function addZipPrefix(str) {
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
if (isAbsolute(str) && !str.match(/^\^zip:/) && (str.match(/\.zip\//) || str.match(/\$\$virtual\//))) {
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
// VSCode only adds it automatically for supported schemes,
// so we have to do it manually for the `zip` scheme.
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
// https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
return `${isVSCode ? '^' : ''}zip:${str.replace(/^\/?/, `/`)}`;
} else {
return str;
}
}
function removeZipPrefix(str) {
return process.platform === 'win32'
? str.replace(/^\^?zip:\//, ``)
: str.replace(/^\^?zip:/, ``);
}
};
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsserver.js
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/lib/tsserver.js your application uses
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`));

View file

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve, dirname} = require(`path`);
const relPnpApiPath = "../../../../.pnp.js";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/typescript.js
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/lib/typescript.js your application uses
module.exports = absRequire(`typescript/lib/typescript.js`);

View file

@ -1,6 +0,0 @@
{
"name": "typescript",
"version": "4.0.3-pnpify",
"main": "./lib/typescript.js",
"type": "commonjs"
}

View file

@ -1 +0,0 @@
yarnPath: ".yarn/releases/yarn-berry.js"

View file

@ -1,19 +1,33 @@
FROM jrottenberg/ffmpeg:4.0-scratch
FROM node:13
FROM node:14-alpine AS base
# Copy ffmpeg bins
COPY --from=0 / /
# Install ffmpeg
RUN apk add --no-cache ffmpeg
WORKDIR /usr/app
COPY package.json .
COPY package* ./
RUN yarn install
# Dependencies
FROM base AS dependencies
RUN npm install
# Build app
FROM dependencies AS builder
COPY . .
RUN yarn run build
RUN npm run build
RUN ls
# Only copy essentials
FROM base AS prod
RUN ls
COPY --from=builder /usr/app/dist dist
RUN npm i --only=prod
ENV DATA_DIR /data
CMD ["yarn", "start"]
CMD ["npm", "run", "start"]

4017
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -16,10 +16,10 @@
"lint": "eslint 'src/**/*.ts'",
"lint-fix": "eslint 'src/**/*.ts' --fix",
"clean": "rm -rf dist dts",
"test": "yarn lint",
"test": "npm run lint",
"build": "tsc",
"watch": "tsc --watch",
"prepack": "yarn clean && yarn build",
"prepack": "npm run clean && npm run build",
"start": "node dist/index.js",
"dev": "nodemon",
"docker-publish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t codetheweb/muse:latest --push ."
@ -42,6 +42,7 @@
"husky": "^4.3.0",
"nodemon": "^2.0.6",
"reflect-metadata": "^0.1.13",
"sqlite3": "^5.0.0",
"ts-node": "^9.0.0",
"typescript": "^4.0.3"
},
@ -88,7 +89,6 @@
"sequelize-typescript": "^1.1.0",
"spotify-uri": "^2.1.0",
"spotify-web-api-node": "^5.0.0",
"sqlite3": "^5.0.0",
"unique-random-array": "^2.0.0",
"youtube.ts": "^0.1.8",
"ytdl-core": "^3.4.2"

4499
yarn.lock

File diff suppressed because it is too large Load diff