npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sandcastle-testing-shailesh

v1.0.0

Published

1. `npx create-react-app appname --template typescript` 2. `yarn add @sc/api @sc/components @sc/modules @sc/plugins` 3. `yarn add -D customize-cra react-app-rewired` 4. open `package.json` and make following changes... ``` "name": "@sc/appname"

Downloads

4

Readme

Welcome to Sandcastle

How create a new app

  1. npx create-react-app appname --template typescript

  2. yarn add @sc/api @sc/components @sc/modules @sc/plugins

  3. yarn add -D customize-cra react-app-rewired

  4. open package.json and make following changes...

    "name": "@sc/appname",
    "scripts": {
       "clean": "rm -rf node_modules build",
       "start": "react-app-rewired start",
       "build": "react-app-rewired build",
       "test": "CI=true react-app-rewired test",
       "eject": "react-scripts eject"
    }
  5. create a file called config-overrides.js and set its content to

     const { override, babelInclude, addBundleVisualizer } = require('customize-cra')
     const path = require('path')
    
     module.exports = override(
       process.env.BUNDLE_VISUALIZE && addBundleVisualizer(),
       babelInclude([
         path.resolve('./'),
         path.resolve('../../plugins'),
         path.resolve('../../platform'),
       ]),
     )
  6. create a file called .env and set its content to

     SKIP_PREFLIGHT_CHECK=true

How to deploy

  1. sudo yarn production
  2. sudo yarn build-10mf
    • (if live site build change: yarn build, zip build)
    • sudo git commit -am "Production Build"
    • sudo git push
    • sudo yarn ssh-production
    • cd sandcastle
    • sudo git pull
    • (if live site build changed: cd apps/livesite, sudo rm -rf build/ && sudo unzip build)
    • sudo yarn restart-servers
    • logout
  3. sudo yarn deploy-production

How to update the db schema in production

  1. update schema platform/api/db/prisma/datamodel.prisma
  2. test locally platform/api/db/prisma/npx prisma deploy
  3. if you created a new table, update this file platform/server/data/resolvers
    1. Add to Query key
    2. Add to Mutation key (createX, updateX, updateManyX, upsertX, deleteX, deleteManyX)
    3. Add a new resolver key for the new table
    4. Update any resolvers to reflect new relationships
    • secret is to clone a previous key as an example
  4. deploy on production

How to create a white label

I. Set up cloudfront for app

  1. create a new distribution and point it to the sandcastle app
  2. connect it to your domain
    1. get domain from client
    2. ask client to point dns to cloudfront url
    3. create ssl for it (using amazon acm)
    4. connect ssl to it

II. Set up cloudfront for sites

  1. clone TMF distribution for _.domain.com a. point it to sandcastesites s3 b. get domain from client c. ask client to point dns to cloudfront url d. add domain to cloudfront _.domain.com e. create ssl for it (using amazon acm or set up via nginx proxy & acm upload)
  2. update config.js & .env files to use cloudfront id & s3 dynamically (pull from db)

How to set up this app from scratch

Prerequisites: Make sure node, yarn, redis, docker, docker-compose, and prisma are installed globally

How to install everything

  1. git clone http://github.com/ambid/sandcastle
  2. chown -R {owner} ./sandcastle
  3. cd sandcastle
  4. yarn

How to set up environment variables

  1. touch ./client.local.js ./env.local
  2. for ./env.local, populate with
SKIP_PREFLIGHT_CHECK=true
SERVER_ENDPOINT=localhost
REACT_APP_SERVER_ENDPOINT=$SERVER_ENDPOINT
DOMAINS_ENDPOINT=localhost
INTEGRATIONS_ENDPOINT=zjbdm9olm3.execute-api.us-east-1.amazonaws.com
CLOUDFRONT_DISTRIBUTION_ID=E3SM2W9RZFSO5L
REACT_APP_CLOUDFRONT_DISTRIBUTION_ID=$CLOUDFRONT_DISTRIBUTION_ID
S3_SITES_BUCKET=sandcastlesites-staging
REACT_APP_CNAME=localhost
  1. for ./client.local.js, populate with
import { InMemoryCache } from "apollo-cache-inmemory";
import { ApolloClient } from "apollo-client";
import { createUploadLink } from "apollo-upload-client";
import "isomorphic-fetch";

const uri = "http://localhost:4000"; // should be the url of the graphql server

export const client = new ApolloClient({
  link: createUploadLink({ uri }),
  cache: new InMemoryCache()
});

How to set up the prisma server from scratch...

  1. cd api/db/
  2. mv prisma xprisma
  3. mkdir prisma && cd prisma
  4. npx prisma init > Create new database | mysql | Javascript |
  5. sudo rm -rf ./generated && sudo mv ../xprisma/* ./
  6. sudo rm -rf ../xprisma
  7. docker-compose up -d
  8. npx prisma deploy
  9. Paste in and execute the contents of ./newAccount.graphql

How to start everything

  1. yarn local <- sets the .env files so that system knows to work on local resources
  2. yarn start-all <- starts all the servers
  3. yarn start <- starts the app
  4. yarn storybook <- starts the component storybook