Which scripts can I run from the following piece of package.json file without breaking anything? - material-ui

I apologize in advance if my question is inappropriate. I want to contribute to Open Source projects in the future. I've cloned one repo (MUI) and It feels like I'm not ready to contribute for now even though I know what package.json is and what it does. However in this case the scripts section is pretty clunky and I'm a bit afraid of trying one of these scripts. Is there a way to run something like "npm start" in create-react-app so I could explore the project? I would really appreciate your help.
"scripts":
{
"proptypes": "cross-env BABEL_ENV=development babel-node --extensions \".tsx,.ts,.js\" ./scripts/generateProptypes.ts",
"deduplicate": "node scripts/deduplicate.js",
"benchmark:browser": "yarn workspace benchmark browser",
"build:codesandbox": "lerna run --parallel --scope \"#mui/*\" build",
"release:version": "lerna version --no-changelog --no-push --no-git-tag-version --force-publish=#mui/core-downloads-tracker",
"release:build": "lerna run --parallel --scope \"#mui/*\" build",
"release:changelog": "node scripts/releaseChangelog",
"release:publish": "lerna publish from-package --dist-tag latest --contents build",
"release:publish:dry-run": "lerna publish from-package --dist-tag latest --contents build --registry=\"http://localhost:4873/\"",
"release:tag": "node scripts/releaseTag",
"docs:api": "rimraf ./docs/pages/**/api-docs ./docs/pages/**/api && yarn docs:api:build",
"docs:api:build": "cross-env BABEL_ENV=development __NEXT_EXPORT_TRAILING_SLASH=true babel-node --extensions \".tsx,.ts,.js\" ./docs/scripts/buildApi.ts",
"docs:build": "yarn workspace docs build",
"docs:build-sw": "yarn workspace docs build-sw",
"docs:build-color-preview": "babel-node scripts/buildColorTypes",
"docs:deploy": "yarn workspace docs deploy",
"docs:dev": "yarn workspace docs dev",
"docs:export": "yarn workspace docs export",
"docs:icons": "yarn workspace docs icons",
"docs:size-why": "cross-env DOCS_STATS_ENABLED=true yarn docs:build",
"docs:start": "yarn workspace docs start",
"docs:i18n": "cross-env BABEL_ENV=development babel-node --extensions \".tsx,.ts,.js\" ./docs/scripts/i18n.js",
"docs:typescript": "yarn docs:typescript:formatted --watch",
"docs:typescript:check": "yarn workspace docs typescript",
"docs:typescript:formatted": "cross-env BABEL_ENV=development babel-node --extensions \".tsx,.ts,.js\" ./docs/scripts/formattedTSDemos",
"docs:mdicons:synonyms": "cross-env BABEL_ENV=development babel-node --extensions \".tsx,.ts,.js\" ./docs/scripts/updateIconSynonyms && yarn prettier",
"extract-error-codes": "cross-env MUI_EXTRACT_ERROR_CODES=true lerna run --parallel build:modern",
"template:screenshot": "cross-env BABEL_ENV=development babel-node --extensions \".tsx,.ts,.js\" ./docs/scripts/generateTemplateScreenshots",
"install:codesandbox": "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install --ignore-engines",
"jsonlint": "node ./scripts/jsonlint.js",
"lint": "eslint . --cache --report-unused-disable-directives --ext .js,.ts,.tsx --max-warnings 0",
"lint:ci": "eslint . --report-unused-disable-directives --ext .js,.ts,.tsx --max-warnings 0",
"stylelint": "stylelint --reportInvalidScopeDisables --reportNeedlessDisables docs/**/*.{js,ts,tsx}",
"markdownlint": "markdownlint \"**/*.md\" --config .markdownlint.jsonc",
"prettier": "node ./scripts/prettier.js",
"prettier:all": "node ./scripts/prettier.js write",
"size:snapshot": "node --max-old-space-size=4096 ./scripts/sizeSnapshot/create",
"size:why": "yarn size:snapshot --analyze",
"start": "yarn && yarn docs:dev",
"t": "node test/cli.js",
"test": "yarn lint && yarn typescript && yarn test:coverage",
"test:coverage": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=text mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}' 'scripts/**/*.test.{js,ts,tsx}' 'test/utils/**/*.test.{js,ts,tsx}'",
"test:coverage:ci": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=lcov mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}' 'scripts/**/*.test.{js,ts,tsx}' 'test/utils/**/*.test.{js,ts,tsx}'",
"test:coverage:html": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=html mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}' 'scripts/**/*.test.{js,ts,tsx}' 'test/utils/**/*.test.{js,ts,tsx}'",
"test:e2e": "cross-env NODE_ENV=production yarn test:e2e:build && concurrently --success first --kill-others \"yarn test:e2e:run\" \"yarn test:e2e:server\"",
"test:e2e:build": "webpack --config test/e2e/webpack.config.js",
"test:e2e:dev": "concurrently \"yarn test:e2e:build --watch\" \"yarn test:e2e:server\"",
"test:e2e:run": "mocha --config test/e2e/.mocharc.js 'test/e2e/**/*.test.{js,ts,tsx}'",
"test:e2e:server": "serve test/e2e",
"test:e2e-website": "playwright test test/e2e-website --config test/e2e-website/playwright.config.ts",
"test:e2e-website:dev": "cross-env PLAYWRIGHT_TEST_BASE_URL=http://localhost:3000 playwright test test/e2e-website --config test/e2e-website/playwright.config.ts",
"test:karma": "cross-env NODE_ENV=test karma start test/karma.conf.js",
"test:karma:profile": "cross-env NODE_ENV=test karma start test/karma.conf.profile.js",
"test:regressions": "cross-env NODE_ENV=production yarn test:regressions:build && concurrently --success first --kill-others \"yarn test:regressions:run\" \"yarn test:regressions:server\"",
"test:regressions:build": "webpack --config test/regressions/webpack.config.js",
"test:regressions:dev": "concurrently \"yarn test:regressions:build --watch\" \"yarn test:regressions:server\"",
"test:regressions:run": "mocha --config test/regressions/.mocharc.js --delay 'test/regressions/**/*.test.js'",
"test:regressions:server": "serve test/regressions",
"test:umd": "node packages/mui-material/test/umd/run.js",
"test:unit": "cross-env NODE_ENV=test mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}' 'scripts/**/*.test.{js,ts,tsx}' 'test/utils/**/*.test.{js,ts,tsx}'",
"test:argos": "node ./scripts/pushArgos.js",
"typescript": "lerna run --no-bail --parallel typescript",
"typescript:ci": "lerna run --concurrency 7 --no-bail --no-sort typescript",
"validate-declarations": "babel-node --extensions \".ts\" scripts/validateTypescriptDeclarations.ts",
"generate-codeowners": "node scripts/generateCodeowners.mjs"
},

There is start command
"start": "yarn && yarn docs:dev"
You should be able to run yarn start in your console.
On the topic "what if you break something", well its cloned local copy, so what... just delete it and clone it again if you need to.

Related

'npm run serve' is not initiallizing project in browser

I am running 'npm run serve' command to execute my vue project in browser . But it is not giving any output or error it just keep running
enter image description here
it just stucks here only
I have tried every thing I have restarted my system and reinstalled vue-cli also but it it didn't worked.
I was running perfectly fine yesterday but today it's not working in fact it wasted my whole day
What did I try
Execute 'npm run serve' cmd
What I Expect
To open my project in Browser
npm run serve will run the built version of your project. It sound to me like you want to run it locally in the browser (for dev and testing) and should use npm run dev.
npm run serve will only serve the output of a npm run build command, and is usually only run after deploying to an actual server.
{
"name": "fer-07-project",
"version": "1.0.0",
"description": "",
"main": "index.html",
"scripts": {
"lint": "eslint --fix --ext .js,.jsx .",
"init-project": "npm install && npm-run-all init:*",
"init:dirs": "mkdirp dist src/sass src/css src/vendor src/images src/js",
"init:files": "touch README.md src/index.html src/sass/style.scss src/js/script.js",
"init:gitignore": "curl https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore -o .gitignore",
"init:gitignore:custom": "echo \"dist\" >> .gitignore",
"test": "npm-run-all test:*",
"test:html": "globstar nu-html-checker dist/*.html",
"test:js": "eslint src/js/ --fix",
"test:scss": "stylelint src/sass/",
"build": "npm-run-all build:* test",
"build:clean": "mkdirp dist && rm -r dist && mkdirp dist",
"build:copy": "copyfiles -a -u 1 -e \"**/sass/**/*\" -e \"**/.gitkeep\" \"src/**/*\" dist",
"build:sass": "node-sass --output-style compact -o dist/css src/sass",
"build:autoprefixer": "globstar autoprefixer-cli \"dist/css/*.css\"",
"build-dev": "npm-run-all build-dev:sass build:autoprefixer",
"build-dev:sass": "node-sass --output-style expanded --source-map true -o dist/css src/sass",
"server": "json-server --port 3131 --no-cors --delay 250 --watch dist/db/app.json",
"watch": "npm-run-all build build-dev -p watch:* server",
"watch:browsersync": "browser-sync start --server dist --files \"dist/**/*\" --ignore \"dist/db/**/*\"",
"watch:sassprefixer": "onchange \"src/sass/**/*.scss\" -- npm run build-dev",
"watch:copy": "onchange -e \"**/sass/**/*\" -e \"**/.gitkeep\" \"src/**/*\" -- copyfiles -a -u 1 {{changed}} dist"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"flatpickr": "^4.6.9",
"json-server": "^0.16.3",
"rangeslider-pure": "^0.4.11"
},
"devDependencies": {
"autoprefixer-cli": "^1.0.0",
"browser-sync": "^2.26.3",
"copyfiles": "^2.1.0",
"eslint": "^5.14.1",
"globstar": "^1.0.0",
"mkdirp": "^0.5.1",
"node-sass": "^4.11.0",
"npm-run-all": "^4.1.5",
"nu-html-checker": "^0.1.0",
"onchange": "^5.2.0",
"stylelint": "^9.10.1",
"stylelint-scss": "^3.5.4"
}
}

How can I deploy to gh-pages using json-server and parcel command?

I want to distribute what I have studied.
In local , open a screen by typing the following in a terminal:
"parcel index.html",
"json-server --watch products.json --port 8080",
"json-server users.json -m ./node_modules/json-server-auth"
How can I deploy and host this on gh-pages?

How do I add Pulumi to my GitHub Codespaces / VSCode .NET devcontainer?

I want to develop and deploy IaC with Pulumi .NET / C# from a VS Code .devcontainer. How can I add this capability to the environment?
I included the build container steps from https://github.com/pulumi/pulumi-docker-containers/blob/main/docker/dotnet/Dockerfile into .devcontainer/Dockerfile:
ARG DOTNET_VARIANT="3.1"
ARG PULUMI_VERSION=latest
ARG INSTALL_NODE="true"
ARG NODE_VERSION="lts/*"
# --------------------------------------------------------------------------------
FROM debian:11-slim AS builder
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y \
curl \
build-essential \
git
RUN if [ "$PULUMI_VERSION" = "latest" ]; then \
curl -fsSL https://get.pulumi.com/ | bash; \
else \
curl -fsSL https://get.pulumi.com/ | bash -s -- --version $PULUMI_VERSION ; \
fi
# --------------------------------------------------------------------------------
FROM mcr.microsoft.com/vscode/devcontainers/dotnetcore:0-${DOTNET_VARIANT}
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
COPY --from=builder /root/.pulumi/bin/pulumi /pulumi/bin/pulumi
COPY --from=builder /root/.pulumi/bin/*-dotnet* /pulumi/bin/
ENV PATH "/pulumi/bin:${PATH}"
and I control the process with this .devcontainer/devcontainer.json:
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.203.0/containers/alpine
{
"name": "C# (.NET)",
"build": {
"dockerfile": "Dockerfile",
"args": {
"DOTNET_VARIANT": "3.1",
"PULUMI_VERSION": "latest",
"INSTALL_NODE": "true",
"NODE_VERSION": "lts/*"
}
},
"features": {
"azure-cli": "latest"
},
// Set *default* container specific settings.json values on container create.
"settings": {},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-dotnettools.csharp"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",
// Replace when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--init", "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
"runArgs": [
"--init"
],
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
be aware that the Rebuild will take a while and that you probably have to reload the devcontainer once it indicates success in the GitHub Codespaces: Details.
After that pulumi login and e.g. pulumi new azure-csharp should work on the container.
You can spin up a codespace, and configure the devcontainer from within the codespace.
I did it just now,
Access the Command Palette (Shift + Command + P / Ctrl + Shift + P), then >start typing "dev container". Select Codespaces: Add Development Container >Configuration Files....
just follow this guide
from within following this guide - https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/setting-up-your-project-for-codespaces
I was inspired by the builder container approach for DOTNET mentioned in this thread, and here is how I added pulumi to my GO codespace dockerfile.
Dockerfile
ARG GO_VARIANT="1"
ARG PULUMI_VERSION=latest
FROM debian:11-slim AS builder
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y \
curl \
build-essential \
git
RUN if [ "$PULUMI_VERSION" = "latest" ]; then \
curl -fsSL https://get.pulumi.com/ | bash; \
else \
curl -fsSL https://get.pulumi.com/ | bash -s -- --version $PULUMI_VERSION ; \
fi
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${GO_VARIANT}
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
COPY --from=builder /root/.pulumi/bin/pulumi /pulumi/bin/pulumi
COPY --from=builder /root/.pulumi/bin/*-go* /pulumi/bin/
ENV PATH "/pulumi/bin:${PATH}"
ENV GOOS "linux"
ENV GOARCH "amd64"
Snippit of code from devcontainer.json
"args": {
... //redacted for clarity
"GO_VARIANT": "1.18",
}
)
I can login with azure, pulumi and pulumi up is also working.
Full example here
https://github.com/DevOpsJava/solution-using-secret
I fixed an issue with pulumi up, which turned out to be a resource problem regarding memory. Switched codespace from 2 to 4 cores, which also doubled the memory to 8GB.

Run command after `docker-compose up --build` finishes

I've got the following package.json
"dev": "yarn dc && yarn run-services",
"run-services": "for I in services/*/; do echo \"cd $I && yarn dev\" | perl -p -e 's/\\n/\\0/;'; done | xargs -0 concurrently --kill-others",
"dc": "docker-compose up --build
I need run-services to run after Docker Compose has built and started the containers. I can use yarn dc & yarn run-services to run them in parallel, but this isn't what I need. I use && to run them sequentially, run-services never runs.
How can I solve this?

golang dlv unable to see source:: no such file or directory

In a docker container:
docker run \
--rm -it \
-p 80:80 \
-p 2345:2345 \
-v $(pwd)/src:/go/src/ \
--security-opt="seccomp=unconfined" \
--privileged \
--cap-add SYS_PTRACE \
golang bash
In the container at $GOPATH:
go get -u github.com/derekparker/delve/cmd/dlv
dlv version
Delve Debugger
Version: 1.1.0
Build: $Id: 1990ba12450cab9425a2ae62e6ab988725023d5c
dlv debug app --headless --listen=0.0.0.0:2345 --api-version=2
In mac terminal at $GOPATH::
dlv version
Delve Debugger
Version: 1.1.0
Build: $Id: 1990ba12450cab9425a2ae62e6ab988725023d5c $
dlv connect 127.0.0.1:2345
I get the following, but unable to list source?
dlv connect 127.0.0.1:2345
Type 'help' for list of commands.
(dlv) b main.go:29
Breakpoint 1 set at 0x7f584d for main.main.func1() /go/src/app/main.go:29
(dlv) c
> main.main.func1() /go/src/app/main.go:29 (hits goroutine(4):1 total:1) (PC: 0x7f584d)
(dlv) l
> main.main.func1() /go/src/app/main.go:29 (hits goroutine(4):1 total:1) (PC: 0x7f584d)
Command failed: open /go/src/app/main.go: no such file or directory
Note: I am in $GOPATH in both the dlv server and client:
In container:
ls $GOPATH/src/app
layout.html main.go mypack
In mac terminal:
ls $GOPATH/src/app
layout.html main.go mypack
vs code launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Connect to server",
"type": "go",
"request": "launch",
"mode": "remote",
"remotePath": "${workspaceFolder}",
"port": 2345,
"host": "127.0.0.1",
"program": "${workspaceFolder}",
"env": {},
"args": [],
"trace": "verbose"
},
]
}
See https://github.com/go-delve/delve/issues/1438. Solution is to put this in
$HOME/.dlv/config.yml:
substitute-path:
- {from: /, to: /root}
On my Ubuntu 18.04 I see the location of the file as ~/.config/dlv/config.yml. Here is an example:
substitute-path:
- {from: /code, to: /home/foo/git/repo}
I wanted to add to the answers above that you do not necessarily need to create a config.yaml file to set substitute-path, you can also do so from inside dlv shell by running: config substitute-path / /root