repo stringlengths 5 106 | file_url stringlengths 78 301 | file_path stringlengths 4 211 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:56:49 2026-01-05 02:23:25 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/app/containers/App/tests/reducer.test.js | app/containers/App/tests/reducer.test.js | import produce from 'immer';
import appReducer from '../reducer';
import { loadRepos, reposLoaded, repoLoadingError } from '../actions';
/* eslint-disable default-case, no-param-reassign */
describe('appReducer', () => {
let state;
beforeEach(() => {
state = {
loading: false,
error: false,
c... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/app/containers/App/tests/index.test.js | app/containers/App/tests/index.test.js | import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import App from '../index';
const renderer = new ShallowRenderer();
describe('<App />', () => {
it('should render and match the snapshot', () => {
renderer.render(<App />);
const renderedOutput = renderer.getRenderOutput(... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/app/containers/App/tests/actions.test.js | app/containers/App/tests/actions.test.js | import { LOAD_REPOS, LOAD_REPOS_SUCCESS, LOAD_REPOS_ERROR } from '../constants';
import { loadRepos, reposLoaded, repoLoadingError } from '../actions';
describe('App Actions', () => {
describe('loadRepos', () => {
it('should return the correct type', () => {
const expectedResult = {
type: LOAD_REP... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/app/containers/App/tests/selectors.test.js | app/containers/App/tests/selectors.test.js | import {
selectGlobal,
makeSelectCurrentUser,
makeSelectLoading,
makeSelectError,
makeSelectRepos,
makeSelectLocation,
} from '../selectors';
describe('selectGlobal', () => {
it('should select the global state', () => {
const globalState = {};
const mockedState = {
global: globalState,
... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/scripts/setup.js | internals/scripts/setup.js | #!/usr/bin/env node
const shell = require('shelljs');
const { exec } = require('child_process');
const path = require('path');
const fs = require('fs');
const readline = require('readline');
const compareVersions = require('compare-versions');
const chalk = require('chalk');
const animateProgress = require('./helpers... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/scripts/analyze.js | internals/scripts/analyze.js | #!/usr/bin/env node
const shelljs = require('shelljs');
const chalk = require('chalk');
const animateProgress = require('./helpers/progress');
const addCheckMark = require('./helpers/checkmark');
const progress = animateProgress('Generating stats');
// Generate stats.json file with webpack
shelljs.exec(
'webpack -... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/scripts/extract-intl.js | internals/scripts/extract-intl.js | /* eslint-disable no-restricted-syntax */
/**
* This script will extract the internationalization messages from all components
* and package them in the translation json files in the translations file.
*/
require('shelljs/global');
const fs = require('fs');
const nodeGlob = require('glob');
const { transform } = r... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/scripts/npmcheckversion.js | internals/scripts/npmcheckversion.js | const { exec } = require('child_process');
exec('npm -v', (err, stdout) => {
if (err) throw err;
if (parseFloat(stdout) < 5) {
// NOTE: This can happen if you have a dependency which lists an old version of npm in its own dependencies.
throw new Error(`[ERROR] You need npm version @>=5 but you have ${stdout... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/scripts/clean.js | internals/scripts/clean.js | const shell = require('shelljs');
const addCheckMark = require('./helpers/checkmark.js');
if (!shell.which('git')) {
shell.echo('Sorry, this script requires git');
shell.exit(1);
}
if (!shell.test('-e', 'internals/templates')) {
shell.echo('The example is deleted already.');
shell.exit(1);
}
process.stdout.w... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/scripts/generate-templates-for-linting.js | internals/scripts/generate-templates-for-linting.js | /**
* This script is for internal `react-boilerplate`'s usage.
* It will run all generators in order to be able to lint them and detect
* critical errors. Every generated component's name starts with 'RbGenerated'
* and any modified file is backed up by a file with the same name but with the
* 'rbgen' extension so... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/scripts/helpers/get-npm-config.js | internals/scripts/helpers/get-npm-config.js | const fs = require('fs');
module.exports = JSON.parse(fs.readFileSync('package.json', 'utf8'));
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/scripts/helpers/progress.js | internals/scripts/helpers/progress.js | const readline = require('readline');
/**
* Adds an animated progress indicator
*
* @param {string} message The message to write next to the indicator
* @param {number} [amountOfDots=3] The amount of dots you want to animate
*/
function animateProgress(message, amountOfDots = 3) {
let i = 0;
return set... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/scripts/helpers/xmark.js | internals/scripts/helpers/xmark.js | const chalk = require('chalk');
/**
* Adds mark cross symbol
*/
function addXMark(callback) {
process.stdout.write(chalk.red(' ✘'));
if (callback) callback();
}
module.exports = addXMark;
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/scripts/helpers/checkmark.js | internals/scripts/helpers/checkmark.js | const chalk = require('chalk');
/**
* Adds mark check symbol
*/
function addCheckMark(callback) {
process.stdout.write(chalk.green(' ✓'));
if (callback) callback();
}
module.exports = addCheckMark;
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/mocks/cssModule.js | internals/mocks/cssModule.js | module.exports = 'CSS_MODULE';
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/mocks/image.js | internals/mocks/image.js | module.exports = 'IMAGE_MOCK';
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/webpack/webpack.base.babel.js | internals/webpack/webpack.base.babel.js | /**
* COMMON WEBPACK CONFIGURATION
*/
const path = require('path');
const webpack = require('webpack');
module.exports = options => ({
mode: options.mode,
entry: options.entry,
output: Object.assign(
{
// Compile into js/build.js
path: path.resolve(process.cwd(), 'build'),
publicPath: '/... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/webpack/webpack.prod.babel.js | internals/webpack/webpack.prod.babel.js | // Important modules this config uses
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackPwaManifest = require('webpack-pwa-manifest');
const OfflinePlugin = require('offline-plugin');
const { HashedModuleIdsPlugin } = require('webpack');
const TerserPlugin = require('t... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/webpack/webpack.dev.babel.js | internals/webpack/webpack.dev.babel.js | /**
* DEVELOPMENT WEBPACK CONFIGURATION
*/
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
module.exports = require('./webpack.base.babel')({
mode: 'development',
... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/generators/index.js | internals/generators/index.js | /**
* generator/index.js
*
* Exports the generators so plop knows them
*/
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
const componentGenerator = require('./component/index.js');
const containerGenerator = require('./container/index.js');
const languageGene... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/generators/container/index.js | internals/generators/container/index.js | /**
* Container Generator
*/
const componentExists = require('../utils/componentExists');
module.exports = {
description: 'Add a container component',
prompts: [
{
type: 'input',
name: 'name',
message: 'What should it be called?',
default: 'Form',
validate: value => {
i... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/generators/utils/componentExists.js | internals/generators/utils/componentExists.js | /**
* componentExists
*
* Check whether the given component exist in either the components or containers directory
*/
const fs = require('fs');
const path = require('path');
const pageComponents = fs.readdirSync(
path.join(__dirname, '../../../app/components'),
);
const pageContainers = fs.readdirSync(
path.jo... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/generators/component/index.js | internals/generators/component/index.js | /**
* Component Generator
*/
/* eslint strict: ["off"] */
'use strict';
const componentExists = require('../utils/componentExists');
module.exports = {
description: 'Add an unconnected component',
prompts: [
{
type: 'input',
name: 'name',
message: 'What should it be called?',
defau... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/generators/language/index.js | internals/generators/language/index.js | /**
* Language Generator
*/
const fs = require('fs');
const { exec } = require('child_process');
function languageIsSupported(language) {
try {
fs.accessSync(`app/translations/${language}.json`, fs.F_OK);
return true;
} catch (e) {
return false;
}
}
module.exports = {
description: 'Add a languag... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/global-styles.js | internals/templates/global-styles.js | import { createGlobalStyle } from 'styled-components';
const GlobalStyle = createGlobalStyle`
html,
body {
height: 100%;
width: 100%;
}
body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
body.fontLoaded {
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, san... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/reducers.js | internals/templates/reducers.js | /**
* Combine all reducers in this file and export the combined reducers.
*/
import { combineReducers } from 'redux';
import { connectRouter } from 'connected-react-router';
import history from 'utils/history';
import languageProviderReducer from 'containers/LanguageProvider/reducer';
/**
* Merges the main reduce... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/i18n.js | internals/templates/i18n.js | /**
* i18n.js
*
* This will setup the i18n language files and locale data for your app.
*
* IMPORTANT: This file is used by the internal build
* script `extract-intl`, and must use CommonJS module syntax
* You CANNOT use import/export in this file.
*/
const addLocaleData = require('react-intl').addLocaleD... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/configureStore.js | internals/templates/configureStore.js | /**
* Create the store with dynamic reducers
*/
import { createStore, applyMiddleware, compose } from 'redux';
import { routerMiddleware } from 'connected-react-router';
import createSagaMiddleware from 'redux-saga';
import createReducer from './reducers';
export default function configureStore(initialState = {}, h... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/app.js | internals/templates/app.js | /**
* app.js
*
* This is the entry file for the application, only setup and boilerplate
* code.
*/
// Needed for redux-saga es6 generator support
import '@babel/polyfill';
// Import all the third party stuff
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
impo... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/tests/i18n.test.js | internals/templates/tests/i18n.test.js | import { formatTranslationMessages } from '../i18n';
jest.mock('../translations/en.json', () => ({
message1: 'default message',
message2: 'default message 2',
}));
const esTranslationMessages = {
message1: 'mensaje predeterminado',
message2: '',
};
describe('formatTranslationMessages', () => {
it('should b... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/tests/store.test.js | internals/templates/tests/store.test.js | /**
* Test store addons
*/
import { browserHistory } from 'react-router';
import configureStore from '../configureStore';
describe('configureStore', () => {
let store;
beforeAll(() => {
store = configureStore({}, browserHistory);
});
describe('injectedReducers', () => {
it('should contain an objec... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/loadable.js | internals/templates/utils/loadable.js | import React, { lazy, Suspense } from 'react';
const loadable = (importFunc, { fallback = null } = { fallback: null }) => {
const LazyComponent = lazy(importFunc);
return props => (
<Suspense fallback={fallback}>
<LazyComponent {...props} />
</Suspense>
);
};
export default loadable;
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/history.js | internals/templates/utils/history.js | import { createBrowserHistory } from 'history';
const history = createBrowserHistory();
export default history;
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/injectSaga.js | internals/templates/utils/injectSaga.js | import React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { ReactReduxContext } from 'react-redux';
import getInjectors from './sagaInjectors';
/**
* Dynamically injects a saga, passes component's props as saga arguments
*
* @param {string} key A key of the saga
* @param {funct... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/injectReducer.js | internals/templates/utils/injectReducer.js | import React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { ReactReduxContext } from 'react-redux';
import getInjectors from './reducerInjectors';
/**
* Dynamically injects a reducer
*
* @param {string} key A key of the reducer
* @param {function} reducer A reducer that will be... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/checkStore.js | internals/templates/utils/checkStore.js | import { conformsTo, isFunction, isObject } from 'lodash';
import invariant from 'invariant';
/**
* Validate the shape of redux store
*/
export default function checkStore(store) {
const shape = {
dispatch: isFunction,
subscribe: isFunction,
getState: isFunction,
replaceReducer: isFunction,
run... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/constants.js | internals/templates/utils/constants.js | export const RESTART_ON_REMOUNT = '@@saga-injector/restart-on-remount';
export const DAEMON = '@@saga-injector/daemon';
export const ONCE_TILL_UNMOUNT = '@@saga-injector/once-till-unmount';
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/sagaInjectors.js | internals/templates/utils/sagaInjectors.js | import invariant from 'invariant';
import { isEmpty, isFunction, isString, conformsTo } from 'lodash';
import checkStore from './checkStore';
import { DAEMON, ONCE_TILL_UNMOUNT, RESTART_ON_REMOUNT } from './constants';
const allowedModes = [RESTART_ON_REMOUNT, DAEMON, ONCE_TILL_UNMOUNT];
const checkKey = key =>
in... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/reducerInjectors.js | internals/templates/utils/reducerInjectors.js | import invariant from 'invariant';
import { isEmpty, isFunction, isString } from 'lodash';
import checkStore from './checkStore';
import createReducer from '../reducers';
export function injectReducerFactory(store, isValid) {
return function injectReducer(key, reducer) {
if (!isValid) checkStore(store);
in... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/tests/injectReducer.test.js | internals/templates/utils/tests/injectReducer.test.js | /**
* Test injectors
*/
import { memoryHistory } from 'react-router-dom';
import React from 'react';
import { Provider } from 'react-redux';
import renderer from 'react-test-renderer';
import { render } from 'react-testing-library';
import configureStore from '../../configureStore';
import injectReducer, { useInjec... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/tests/reducerInjectors.test.js | internals/templates/utils/tests/reducerInjectors.test.js | /**
* Test injectors
*/
import produce from 'immer';
import { memoryHistory } from 'react-router-dom';
import identity from 'lodash/identity';
import configureStore from '../../configureStore';
import getInjectors, { injectReducerFactory } from '../reducerInjectors';
// Fixtures
const initialState = { reduced: '... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/tests/checkStore.test.js | internals/templates/utils/tests/checkStore.test.js | /**
* Test injectors
*/
import checkStore from '../checkStore';
describe('checkStore', () => {
let store;
beforeEach(() => {
store = {
dispatch: () => {},
subscribe: () => {},
getState: () => {},
replaceReducer: () => {},
runSaga: () => {},
injectedReducers: {},
in... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/tests/sagaInjectors.test.js | internals/templates/utils/tests/sagaInjectors.test.js | /**
* Test injectors
*/
import { memoryHistory } from 'react-router-dom';
import { put } from 'redux-saga/effects';
import configureStore from '../../configureStore';
import getInjectors, {
injectSagaFactory,
ejectSagaFactory,
} from '../sagaInjectors';
import { DAEMON, ONCE_TILL_UNMOUNT, RESTART_ON_REMOUNT } f... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/utils/tests/injectSaga.test.js | internals/templates/utils/tests/injectSaga.test.js | /**
* Test injectors
*/
import { memoryHistory } from 'react-router-dom';
import { put } from 'redux-saga/effects';
import renderer from 'react-test-renderer';
import { render } from 'react-testing-library';
import React from 'react';
import { Provider } from 'react-redux';
import configureStore from '../../configu... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/LanguageProvider/selectors.js | internals/templates/containers/LanguageProvider/selectors.js | import { createSelector } from 'reselect';
import { initialState } from './reducer';
/**
* Direct selector to the languageToggle state domain
*/
const selectLanguage = state => state.language || initialState;
/**
* Select the language locale
*/
const makeSelectLocale = () =>
createSelector(
selectLanguage,... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/LanguageProvider/reducer.js | internals/templates/containers/LanguageProvider/reducer.js | /*
*
* LanguageProvider reducer
*
*/
import produce from 'immer';
import { CHANGE_LOCALE } from './constants';
import { DEFAULT_LOCALE } from '../../i18n';
export const initialState = {
locale: DEFAULT_LOCALE,
};
/* eslint-disable default-case, no-param-reassign */
const languageProviderReducer = (state = init... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/LanguageProvider/index.js | internals/templates/containers/LanguageProvider/index.js | /*
*
* LanguageProvider
*
* this component connects the redux state language locale to the
* IntlProvider component and i18n messages (loaded from `app/translations`)
*/
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { createSelector } from 'reselect'... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/LanguageProvider/constants.js | internals/templates/containers/LanguageProvider/constants.js | /*
*
* LanguageProvider constants
*
*/
export const CHANGE_LOCALE = 'app/LanguageToggle/CHANGE_LOCALE';
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/LanguageProvider/actions.js | internals/templates/containers/LanguageProvider/actions.js | /*
*
* LanguageProvider actions
*
*/
import { CHANGE_LOCALE } from './constants';
export function changeLocale(languageLocale) {
return {
type: CHANGE_LOCALE,
locale: languageLocale,
};
}
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/NotFoundPage/index.js | internals/templates/containers/NotFoundPage/index.js | /**
* NotFoundPage
*
* This is the page we show when the user visits a url that doesn't have a route
*
*/
import React from 'react';
import { FormattedMessage } from 'react-intl';
import messages from './messages';
export default function NotFound() {
return (
<h1>
<FormattedMessage {...messages.hea... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/NotFoundPage/messages.js | internals/templates/containers/NotFoundPage/messages.js | /*
* NotFoundPage Messages
*
* This contains all the text for the NotFoundPage container.
*/
import { defineMessages } from 'react-intl';
export const scope = 'app.containers.NotFoundPage';
export default defineMessages({
header: {
id: `${scope}.header`,
defaultMessage: 'This is the NotFoundPage contain... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/NotFoundPage/Loadable.js | internals/templates/containers/NotFoundPage/Loadable.js | /**
* Asynchronously loads the component for NotFoundPage
*/
import loadable from 'utils/loadable';
export default loadable(() => import('./index'));
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/NotFoundPage/tests/index.test.js | internals/templates/containers/NotFoundPage/tests/index.test.js | import React from 'react';
import { render } from 'react-testing-library';
import { IntlProvider } from 'react-intl';
import NotFoundPage from '../index';
describe('<NotFoundPage />', () => {
it('should render and match the snapshot', () => {
const {
container: { firstChild },
} = render(
<IntlP... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/HomePage/index.js | internals/templates/containers/HomePage/index.js | /*
* HomePage
*
* This is the first thing users see of our App, at the '/' route
*
*/
import React from 'react';
import { FormattedMessage } from 'react-intl';
import messages from './messages';
export default function HomePage() {
return (
<h1>
<FormattedMessage {...messages.header} />
</h1>
)... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/HomePage/messages.js | internals/templates/containers/HomePage/messages.js | /*
* HomePage Messages
*
* This contains all the text for the HomePage container.
*/
import { defineMessages } from 'react-intl';
export const scope = 'app.containers.HomePage';
export default defineMessages({
header: {
id: `${scope}.header`,
defaultMessage: 'This is the HomePage container!',
},
});
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/HomePage/Loadable.js | internals/templates/containers/HomePage/Loadable.js | /**
* Asynchronously loads the component for HomePage
*/
import loadable from 'utils/loadable';
export default loadable(() => import('./index'));
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/HomePage/tests/index.test.js | internals/templates/containers/HomePage/tests/index.test.js | import React from 'react';
import { render } from 'react-testing-library';
import { IntlProvider } from 'react-intl';
import HomePage from '../index';
describe('<HomePage />', () => {
it('should render and match the snapshot', () => {
const {
container: { firstChild },
} = render(
<IntlProvider ... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/App/selectors.js | internals/templates/containers/App/selectors.js | import { createSelector } from 'reselect';
const selectRouter = state => state.router;
const makeSelectLocation = () =>
createSelector(
selectRouter,
routerState => routerState.location,
);
export { makeSelectLocation };
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/App/index.js | internals/templates/containers/App/index.js | /**
*
* App.js
*
* This component is the skeleton around the actual pages, and should only
* contain code that should be seen on all pages. (e.g. navigation bar)
*
*/
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import HomePage from 'containers/HomePage/Loadable';
import NotFoun... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/App/constants.js | internals/templates/containers/App/constants.js | /*
* AppConstants
* Each action has a corresponding type, which the reducer knows and picks up on.
* To avoid weird typos between the reducer and the actions, we save them as
* constants here. We prefix them with 'yourproject/YourComponent' so we avoid
* reducers accidentally picking up actions they shouldn't.
*
... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/App/tests/index.test.js | internals/templates/containers/App/tests/index.test.js | import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import App from '../index';
const renderer = new ShallowRenderer();
describe('<App />', () => {
it('should render and match the snapshot', () => {
renderer.render(<App />);
const renderedOutput = renderer.getRenderOutput(... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/templates/containers/App/tests/selectors.test.js | internals/templates/containers/App/tests/selectors.test.js | import { makeSelectLocation } from 'containers/App/selectors';
describe('makeSelectLocation', () => {
it('should select the location', () => {
const router = {
location: { pathname: '/foo' },
};
const mockedState = {
router,
};
expect(makeSelectLocation()(mockedState)).toEqual(router.... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/internals/testing/test-bundler.js | internals/testing/test-bundler.js | // needed for regenerator-runtime
// (ES7 generator support is required by redux-saga)
import '@babel/polyfill';
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/server/index.js | server/index.js | /* eslint consistent-return:0 import/order:0 */
const express = require('express');
const logger = require('./logger');
const argv = require('./argv');
const port = require('./port');
const setup = require('./middlewares/frontendMiddleware');
const isDev = process.env.NODE_ENV !== 'production';
const ngrok =
(isDev... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/server/logger.js | server/logger.js | /* eslint-disable no-console */
const chalk = require('chalk');
const ip = require('ip');
const divider = chalk.gray('\n-----------------------------------');
/**
* Logger middleware, you can customize it to make messages more personal
*/
const logger = {
// Called whenever there's an error on the server we want... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/server/argv.js | server/argv.js | module.exports = require('minimist')(process.argv.slice(2));
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/server/port.js | server/port.js | const argv = require('./argv');
module.exports = parseInt(argv.port || process.env.PORT || '3000', 10);
| javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/server/middlewares/frontendMiddleware.js | server/middlewares/frontendMiddleware.js | /* eslint-disable global-require */
/**
* Front-end middleware
*/
module.exports = (app, options) => {
const isProd = process.env.NODE_ENV === 'production';
if (isProd) {
const addProdMiddlewares = require('./addProdMiddlewares');
addProdMiddlewares(app, options);
} else {
const webpackConfig = re... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/server/middlewares/addProdMiddlewares.js | server/middlewares/addProdMiddlewares.js | const path = require('path');
const express = require('express');
const compression = require('compression');
module.exports = function addProdMiddlewares(app, options) {
const publicPath = options.publicPath || '/';
const outputPath = options.outputPath || path.resolve(process.cwd(), 'build');
// compression m... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
react-boilerplate/react-boilerplate | https://github.com/react-boilerplate/react-boilerplate/blob/d19099afeff64ecfb09133c06c1cb18c0d40887e/server/middlewares/addDevMiddlewares.js | server/middlewares/addDevMiddlewares.js | const path = require('path');
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');
function createWebpackMiddleware(compiler, publicPath) {
return webpackDevMiddleware(compiler, {
logLevel: 'warn',
... | javascript | MIT | d19099afeff64ecfb09133c06c1cb18c0d40887e | 2026-01-04T15:01:46.720890Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/middleware.js | middleware.js | // Exports
// =============================================================================
export const config = {
matcher: ['/preview/(index.html)?'],
};
// Rewrite rules shared with local server configurations
export const rewriteRules = [
// Replace CDN URLs with local paths
{
match: /https?.*\/CHANGELOG... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/playwright.config.js | playwright.config.js | import { devices } from '@playwright/test';
import { testConfig } from './server.configs.js';
const { hostname, port } = testConfig;
const TEST_HOST = `http://${hostname}:${port}`;
process.env.TEST_HOST = TEST_HOST;
/**
* @see https://playwright.dev/docs/test-configuration
* @type {import('@playwright/test').Playw... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/server.configs.js | server.configs.js | import * as path from 'node:path';
import * as url from 'node:url';
import { rewriteRules } from './middleware.js';
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Production (CDN URLs, watch disabled)
export const prodConfig = {
ghostMode: false,
hostname: '1... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/rollup.config.js | rollup.config.js | import fs from 'node:fs/promises';
import path from 'node:path';
import { babel } from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import css from 'rollup-plugin-import-css';
import replace from '@rollup/plugin-replace';
import resolve from '@rollup/plugin-node-resolve';
import terser from '... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/jest.config.js | jest.config.js | import { testConfig } from './server.configs.js';
const { hostname, port } = testConfig;
const TEST_HOST = `http://${hostname}:${port}`;
const sharedConfig = {
errorOnDeprecated: true,
globalSetup: './test/config/jest.setup.js',
globalTeardown: './test/config/jest.teardown.js',
prettierPath: null, // Fix for J... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/eslint.config.js | eslint.config.js | import eslintConfigPrettier from 'eslint-config-prettier';
import playwrightPlugin from 'eslint-plugin-playwright';
import jestPlugin from 'eslint-plugin-jest';
import globals from 'globals';
import js from '@eslint/js';
export default [
// Ignore (Must be first item in array)
{
ignores: [
// Directories... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/server.js | server.js | import { create } from 'browser-sync';
import { devConfig, prodConfig } from './server.configs.js';
const bsServer = create();
const args = process.argv.slice(2);
const config = args.includes('--dev') ? devConfig : prodConfig;
const configName = config === devConfig ? 'development' : 'production';
const isWatch = Bool... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/external-script.js | src/plugins/external-script.js | const window = /** @type {any} */ (globalThis);
function handleExternalScript() {
const container = Docsify.dom.getNode('#main');
const scripts = /** @type {HTMLScriptElement[]} */ (
Docsify.dom.findAll(container, 'script')
);
for (const script of scripts) {
if (script.src) {
const newScript = d... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/emoji.js | src/plugins/emoji.js | import emojiData from '../core/render/emoji-data.js';
const window = /** @type {any} */ (globalThis);
// Deprecation notice
if (window && window.console) {
// eslint-disable-next-line no-console
console.info('Docsify emoji plugin has been deprecated as of v4.13');
}
// Emoji from GitHub API
window.emojify = func... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/disqus.js | src/plugins/disqus.js | const fixedPath = location.href.replace('/-/', '/#/');
if (fixedPath !== location.href) {
location.href = fixedPath;
}
const window = /** @type {any} */ (globalThis);
function install(hook, vm) {
const dom = Docsify.dom;
const disqus = vm.config.disqus;
if (!disqus) {
throw Error('$docsify.disqus is requi... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/matomo.js | src/plugins/matomo.js | function appendScript(options) {
const script = document.createElement('script');
script.async = true;
script.src = options.host + '/matomo.js';
document.body.appendChild(script);
}
const window = /** @type {any} */ (globalThis);
function init(options) {
window._paq = window._paq || [];
window._paq.push([... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/ga.js | src/plugins/ga.js | // From https://github.com/egoist/vue-ga/blob/master/src/index.js
function appendScript() {
const script = document.createElement('script');
script.async = true;
script.src = 'https://www.google-analytics.com/analytics.js';
document.body.appendChild(script);
}
const window = /** @type {any} */ (globalThis);
f... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/zoom-image.js | src/plugins/zoom-image.js | import mediumZoom from 'medium-zoom';
function install(hook) {
let zoom;
hook.doneEach(_ => {
let elms = /** @type {HTMLElement[]} */ (
Array.from(
document.querySelectorAll(
'.markdown-section img:not(.emoji):not([data-no-zoom])',
),
)
);
Docsify.dom.style(
... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/gitalk.js | src/plugins/gitalk.js | const window = /** @type {any} */ (globalThis);
function install(hook) {
const dom = Docsify.dom;
hook.mounted(_ => {
const div = dom.create('div');
div.id = 'gitalk-container';
const main = dom.getNode('#main');
div.style = `width: ${main.clientWidth}px; margin: 0 auto 20px;`;
dom.appendTo(do... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/gtag.js | src/plugins/gtag.js | // From ./ga.js
function appendScript(id) {
const script = document.createElement('script');
script.async = true;
script.src = 'https://www.googletagmanager.com/gtag/js?id=' + id;
document.body.appendChild(script);
}
const window = /** @type {any} */ (globalThis);
// global site tag instance initialized
func... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/front-matter/yaml.js | src/plugins/front-matter/yaml.js | // @ts-nocheck
/**
* Forked from https://github.com/egoist/docute/blob/master/src/utils/yaml.js
*/
/* eslint-disable */
/*
YAML parser for Javascript
Author: Diogo Costa
This program is released under the MIT License as follows:
Copyright (c) 2011 Diogo Costa (costa.h4evr@gmail.com)
Permission is hereby granted, free... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/front-matter/index.js | src/plugins/front-matter/index.js | import parser from './parser.js';
const install = function (hook, vm) {
// Used to remove front matter from embedded pages if installed.
vm.config.frontMatter = {};
vm.config.frontMatter.installed = true;
vm.config.frontMatter.parseMarkdown = function (content) {
const { body } = parser(content);
retur... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/front-matter/parser.js | src/plugins/front-matter/parser.js | /**
* Fork https://github.com/egoist/docute/blob/master/src/utils/front-matter.js
*/
/* eslint-disable */
import parser from './yaml.js';
const optionalByteOrderMark = '\\ufeff?';
const pattern =
'^(' +
optionalByteOrderMark +
'(= yaml =|---)' +
'$([\\s\\S]*?)' +
'(?:\\2|\\.\\.\\.)' +
'$' +
'' +
'(?:... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/search/index.js | src/plugins/search/index.js | import {
init as initComponent,
update as updateComponent,
} from './component.js';
import { init as initSearch } from './search.js';
/**
* @type {{
* placeholder: string;
* noData: string;
* paths: string[] | 'auto';
* depth: number;
* maxAge: number;
* namespace?: string;
* pathNamespaces?:... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/search/component.js | src/plugins/search/component.js | import { escapeHtml, search } from './search.js';
import cssText from './style.css';
let NO_DATA_TEXT = '';
function tpl(vm, defaultValue = '') {
const { insertAfter, insertBefore } = vm.config?.search || {};
const html = /* html */ `
<div class="input-wrap">
<input type="search" value="${defaultValue}"... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/search/markdown-to-txt.js | src/plugins/search/markdown-to-txt.js | /**
* This is a function to convert markdown to txt based on markedjs v13+.
* Copies the escape/unescape functions from [lodash](https://www.npmjs.com/package/lodash) instead import to reduce the size.
*/
import { marked } from 'marked';
const reEscapedHtml = /&(?:amp|lt|gt|quot|#(0+)?39);/g;
const reHasEscapedHtml... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/plugins/search/search.js | src/plugins/search/search.js | import {
getAndRemoveConfig,
getAndRemoveDocsifyIgnoreConfig,
removeAtag,
} from '../../core/render/utils.js';
import { markdownToTxt } from './markdown-to-txt.js';
import Dexie from 'dexie';
let INDEXES = [];
const db = new Dexie('docsify');
db.version(1).stores({
search: 'slug, title, body, path, indexKey',... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/core/global-api.js | src/core/global-api.js | import * as prism from 'prismjs';
import { marked } from 'marked';
import * as util from './util/index.js';
import * as dom from './util/dom.js';
import { Compiler } from './render/compiler.js';
import { slugify } from './render/slugify.js';
import { get } from './util/ajax.js';
export default function initGlobalAPI()... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/core/index.js | src/core/index.js | import { documentReady } from './util/dom.js';
import { Docsify } from './Docsify.js';
import initGlobalAPI from './global-api.js';
/**
* Global API
*/
initGlobalAPI();
/**
* Run Docsify
*/
documentReady(() => new Docsify());
| javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/core/module.min.js | src/core/module.min.js | // This file exists for type declaration output.
export * from './Docsify.js';
| javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/core/config.js | src/core/config.js | import { stripIndent } from 'common-tags';
import { hyphenate, isPrimitive } from './util/core.js';
/** @import { Docsify } from './Docsify.js' */
/** @import { Hooks } from './init/lifecycle.js' */
const currentScript = document.currentScript;
const defaultDocsifyConfig = () => ({
alias: /** @type {Record<string, ... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/core/Docsify.js | src/core/Docsify.js | import prism from 'prismjs';
import { Router } from './router/index.js';
import { Render } from './render/index.js';
import { Fetch } from './fetch/index.js';
import { Events } from './event/index.js';
import { VirtualRoutes } from './virtual-routes/index.js';
import config from './config.js';
import { isFn } from './... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/core/module.js | src/core/module.js | export * from './Docsify.js';
| javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/core/util/core.js | src/core/util/core.js | /**
* Create a cached version of fn that given an input string returns a
* cached return value mapped from the string, regardless if fn is a new function every time.
* created.
* @param {*} fn The function call to be cached
* @void
*/
// TODO Replace this with a proper memo(fn) based on args per function.
export ... | javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
docsifyjs/docsify | https://github.com/docsifyjs/docsify/blob/6d7a8bb5879dcf26e13874198a2f5736a0c7eb32/src/core/util/env.js | src/core/util/env.js | const computedStyle = getComputedStyle(document.documentElement, null);
export const mobileBreakpoint = computedStyle.getPropertyValue(
'--_mobile-breakpoint',
);
export function isMobile() {
return window?.matchMedia?.(`(max-width: ${mobileBreakpoint})`)?.matches;
}
| javascript | MIT | 6d7a8bb5879dcf26e13874198a2f5736a0c7eb32 | 2026-01-04T15:01:33.847794Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.